Jump to content

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


Recommended Posts


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)
ControlFocus("", "", $inputName)

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


Thanks in advance

Edited by doestergaard
Link to comment
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.

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...