Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog field focus and buttons
#1
i have a dialog that when a button is pressed it sets some variables and then sets one of the fields to a value but the button retains the focus.

how do i make the cursor return to the end of a text field on the dialog?

thanks.
A new blog on QM coding and automation.

The Macro Hook
#2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str e3
if(!ShowDialog("Dialog18" &Dialog18 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 222 134 "Form"
;3 Edit 0x54030080 0x200 6 8 96 14 ""
;4 Button 0x54032000 0x0 108 8 48 14 "Button"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2010901 "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam) ;;not necessary in QM >= 2.1.9
,ret 1 ;;not necessary in QM >= 2.1.9
,case WM_DESTROY DT_DeleteData(hDlg) ;;not necessary in QM >= 2.1.9
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,str s.time("%c")
,int he=id(3 hDlg)
,SendMessage he EM_SETSEL 0 -1 ;;select all
,SendMessage he EM_REPLACESEL 0 s ;;replace selection
,SetFocus he
,case IDOK
,DT_Ok hDlg ;;not necessary in QM >= 2.1.9
,case IDCANCEL DT_Cancel hDlg ;;not necessary in QM >= 2.1.9
ret 1
#3
AWESOME!!
did a little.

Code:
Copy      Help
,,SetFocus (id(6 hDlg))
,,'E

and it works great!
A new blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)