TextBox - SelectionStart

0
0

Hi,

I’m building a window dynamically and placing a TextBox on a panel. This TextBox needs to be focussed immediately and the cursor needs to be at the start (SelectionStart = 0).

I’ve tried everything (well, I think I have) and I can’t get WiseJ to do this. I can load a TextBox, place it in the panel and set its TabIndex to 0 but whatever I do, can’t get the cursor flashing at the start, rather than at the end.

Help!

  • You must to post comments
0
0

Thanks Alaa – I’ll watch out for it.

  • You must to post comments
0
0

Hi Neil,

The fix with this issue is available with Wisej 2.5.26.

Best,

Alaa

  • You must to post comments
0
0

That works Frank, thank you. I think I tried every combination of setting focus, selecting text and application.upate (plus others), except the combination above!

  • Neil Hoskins
    The .Call is even easier too, thanks.
  • You must to post comments
0
0

Actually the best way to achieve what you want is by using this:

txtBox.Focus();
txtBox.Call("setTextSelection", 0, 0);

Otherwise the focus cycle is asychnronous and the selection only works with the code I previously posted
to have the cycle finish before.
But this code above is the preferred solution.

Best regards
Frank

  • You must to post comments
0
0

Hi Neil,

as a workaround you can use code like this:

txtBox.Focus();
 
Application.Update(this);
 
txtBox.SelectionStart = 0;
txtBox.SelectionLength = 0;

We are currently investigating this issue and get back to you.

Best regards
Frank

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.