Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Dialog Button's Name
#1
I have the below dialog and would like to snatch the value of the name of button 5 and put it into a string or set the name of the button to a string either way.

How can I best do this?

Function Dialog4
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 297 117 "Dialog"
;3 Button 0x54032000 0x0 0 14 22 11 "Start"
;4 Button 0x54032000 0x0 23 14 22 11 "End"
;5 Static 0x5440C001 0x0 0 2 45 11 "1st Test"
;2 Button 0x54030000 0x0 248 0 48 14 "Close"
;END DIALOG
;DIALOG EDITOR: "" 0x2030601 "" "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4 ;;button clicked
,,EnableWindow id(4 hDlg) 0
,,EnableWindow id(3 hDlg) 1
,,EnableWindow id(2 hDlg) 1
,,;


,case 3 ;;button clicked
,,EnableWindow id(3 hDlg) 0
,,EnableWindow id(4 hDlg) 1
,,EnableWindow id(2 hDlg) 0


ret 1
An old blog on QM coding and automation.

The Macro Hook
#2
is this what your looking for.

Function Dialog3
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str-- st3st = "1st test"
if(!ShowDialog("Dialog3" &Dialog3)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 Static 0x54000000 0x0 8 60 48 13 ""
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030509 "" "" "" ""

ret
;messages

sel message
,case WM_INITDIALOG
,st3st.setwintext(id(3 hDlg))
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
Function Dialog227
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str c3Sta

if(!ShowDialog("Dialog227" &Dialog227 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 297 117 "Dialog"
;5 Static 0x5440C001 0x0 6 4 45 11 ""
;3 Button 0x54031003 0x0 6 22 46 14 "Start"
;2 Button 0x54030000 0x0 248 0 48 14 "Close"
;END DIALOG
;DIALOG EDITOR: "" 0x2030604 "*" "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,if(but(lParam))
,,_s.RandomString(5 5 "A-Z")
,,_s.setwintext(id(5 hDlg))
,else
,,_s.getwintext(id(5 hDlg))

,SetDlgItemText hDlg wParam iif(but(lParam) "End" "Start")

,out F"text: {_s}"
ret 1
#4
DOH!!! thanks all!!
forgot about the setwintext to the id thing!
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)