How do I select the text in a TextBox?

279 Views Asked by At

I found that it's quite easy with nsDialogs to set the focus to a specific control:

${NSD_SETFOCUS} $myHWnd

But is there also a way to select all the text in that control, so that when the user starts typing, what is already there is overwritten?

1

There are 1 best solutions below

0
fretje On

Turns out it's also quite easy using the standard NSIS function SendMessage. You can simply send the EM_SETSEL message with 0 and -1 as parameters:

SendMessage $myHWnd ${EM_SETSEL} 0 -1

This will select all the text in the textbox.