Sign in to follow this  
Followers 0
doestergaard

How to set text cursor at the beginning of an Input control?

3 posts in this topic

#1 ·  Posted (edited)

Hi

Im currently struggling with setting the position of the text cursor to the beginning of an input control. The input control needs to be limited to only 15 characters, but when I apply that, the control focus function will instead highlight the text, rather then place the cursor at the beginning of the input.

If i apply the data directly to the input without the GUICtrlSetLimit, the cursor will be at the beginning of my input control when it gets focused, like so:

Global $inputName = GUICtrlCreateInput($regName, 110, 92, 362, 22)
GUICtrlSetFont($inputName, 10, 0, "", "", $DRAFT_QUALITY)
GUICtrlSetStyle($inputName, $ES_UPPERCASE)
GUISetState()
ControlFocus("", "", $inputName)

How can I achieve this with GUICtrlSetLimit without the whole text getting highligted?

 

Thanks in advance

Edited by doestergaard

Share this post


Link to post
Share on other sites



You can use _GUICtrlEdit_SetSel with providing 'start' and 'end' the same value.


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

You can use _GUICtrlEdit_SetSel with providing 'start' and 'end' the same value.

 

Thanks! Actually, this worked too:

ControlClick($myForm, "", $inputName, "", 1, 1)

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0