Skip to content

Finding the control with focus #3328

Answered by BDisp
dasien asked this question in Q&A
Mar 15, 2024 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

In the v1 the events only use the event and not the event EventHandler and I forgot that. What you can do is in the event call a method that pass the sender to it. e.g.

var tfUserName = new TextField();
tfUserName.Enter += (_) => OnEnter(tfUserName)

var tfUserPwd = new TextField();
tfUserPwd.Enter += (_) => OnEnter(tfUserPwd)

private void OnEnter(View sender)
{
   ((TextField)sender).SelectAllText();
}

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@BDisp
Comment options

Comment options

You must be logged in to vote
2 replies
@BDisp
Comment options

Answer selected by dasien
@dasien
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants