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;
}