SIL.FieldWorks.Common.Framework.DetailControls.Slice.Slice.TakeFocus C# (CSharp) Méthode

TakeFocus() public méthode

The slice should become the focus slice (and return true). If the fOkToFocusTreeNode argument is false, this should happen iff it has a control which is appropriate to focus. Note: JohnT: recently I noticed that trying to focus the tree node doesn't seem to do anything; I'm not sure passing true is useful.
public TakeFocus ( bool fOkToFocusTreeNode ) : bool
fOkToFocusTreeNode bool
Résultat bool
		public bool TakeFocus(bool fOkToFocusTreeNode)
		{
			CheckDisposed();

			Control ctrl = Control;
			if (!Visible)
			{
				if ((ctrl != null && ctrl.TabStop) || fOkToFocusTreeNode)
				{
					// We very possibly want to focus this node, but .NET won't let us focus it till it is visible.
					// Make it so.
					DataTree.MakeSliceVisible(this);
				}
			}

			if (ctrl != null && ctrl.CanFocus && ctrl.TabStop)
			{
				ctrl.Focus();
			}
			else if (fOkToFocusTreeNode)
			{
				TreeNode.Focus();
			}
			else
				return false;

			//this is a bit of a hack, because focus and OnEnter are related but not equivalent...
			//some slices  never get an on enter, but  claim to be focus-able.
			if (ContainingDataTree.CurrentSlice != this)
				ContainingDataTree.CurrentSlice = this;
			return true;
		}

Same methods

Slice.Slice::TakeFocus ( ) : void