WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.X
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

EditBox Cursor Placement


Question:

When I set text in a single line editbox that is longer that the visible area of the edit box, the last portions of that data is what is displayed to the user.

Is it possible to set a long string of text to an edit box, but then move the curser back to the begining of the editbox so the user sees the begining portions of the data instead?

I see there is a trick to make it work for multi-line edit boxes, but couldn't find anything to work for single line edit boxes.

I'm running 2003J.

Answer:

You will need to send the EM_SETSEL (177) and EM_SCROLLCARET (183) message to the edit box using one of several SendMessage mechanisms (dllcall, control manager's csendmessage, or IntControl 22) . You will also need to get the Windows handle to the control.

6.1 Format Dialog Sample

; Highlight MultilineBox using SendMessage EM_SETSEL
cntrlnum = 002
EM_SETSEL = 177
controlhandle = DllCall(DirWindows(1):"USER32.DLL",long:'GetDlgItem',long:MyDialog_Handle,long:cntrlnum+99)
SendMessageA( controlhandle, EM_SETSEL, 0, 0)

6.2 Format Dialog Sample

; Highlight Multiline Editbox
cntrlname =  "MultiLineBox_1"
EM_SETSEL = 177
controlhandle = DialogControlGet( MyDialog_Handle, cntrlname, DC_HANDLE )
SendMessageA( controlhandle, EM_SETSEL, 0, 0)

Article ID:   W16408
File Created: 2010:03:24:12:33:36
Last Updated: 2010:03:24:12:33:36