public TakeFocus ( Direction direction, Selection selection, System.Action action ) : void | ||
direction | Direction | |
selection | Selection | |
action | System.Action | |
return | void |
public void TakeFocus( Direction direction, Selection selection, Action action )
{
Focus();
switch ( action )
{
case Action.Trim:
if ( TextLength > 0 )
{
int newLength = TextLength - 1;
Text = Text.Substring( 0, newLength );
}
SelectionStart = TextLength;
return;
case Action.Home:
SelectionStart = 0;
SelectionLength = 0;
return;
case Action.End:
SelectionStart = TextLength;
return;
}
if ( selection == Selection.All )
{
SelectionStart = 0;
SelectionLength = TextLength;
}
else
{
if ( direction == Direction.Forward )
{
SelectionStart = 0;
}
else
{
SelectionStart = TextLength;
}
}
}