Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't Close a Dialog
#1
i have a dialog that i've jacked up some how. I took off the OK and CANCEL buttons but now i want to put the CANCEL button back on (only because Alt-F4 and the Red "X" at the top right don't close the dialog). why won't Alt-F4 and the Red "X" at the top right don't close the dialog? and what am i doing wrong here that i cant seem to add a Cancel button?

any help would be appriciated.



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

str flnName

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 242 116 "Scratch Pad"
;3 Edit 0x540F14C4 0x101 3 44 236 70 ""
;4 Button 0x5C032000 0x0 8 4 48 14 "&Save"
;2 Button 0x5C030000 0x0 66 4 68 14 "Save and &Close"
;5 Edit 0x54070000 0x101 3 26 236 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""


ret
;messages
sel message
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_SIZE
,;RECT r; GetClientRect hDlg &r
,;MoveWindow id(3 hDlg) 5 69 r.right-10 r.bottom-75 1
,;MoveWindow id(5 hDlg) 5 42 r.right-10 23 1

ret
;messages2
sel wParam
,case 6
,,;clo win("Scratch Pad" "#32770" "qm")
,,ret 1
,case EN_CHANGE<<16|3
,,EnableWindow id(4 "Scratch Pad") 1
,,EnableWindow id(2 "Scratch Pad") 1    
,case EN_SETFOCUS<<16|3
,,0.05
,,'CH
,,mov -401 792 win("Scratch Pad" "#32770" "")
,case 4
,,flnName.getwintext(id(5 "Scratch Pad"))
,,_s.getwintext(id(3 "Scratch Pad"))
,,_s.setfile(flnName)
,,EnableWindow id(4 "Scratch Pad") 0
,,EnableWindow id(2 "Scratch Pad") 0    
,,bee "C:\downloads\sounds\st sounds\comp clicks etc\b\c810.wav"        
,case 2
,,flnName.getwintext(id(5 "Scratch Pad"))
,,_s.getwintext(id(3 "Scratch Pad"))
,,_s.setfile(flnName)
,,ret 1
,;case IDOK
,case IDCANCEL
ret 1
An old blog on QM coding and automation.

The Macro Hook
#2
Cancel button's id is 2 (IDCANCEL). You already have button id 2.
#3
Ahhhhh...Cancel can't be 6 huh :wink:

thanks.
An old blog on QM coding and automation.

The Macro Hook
#4
OK - 1, IDOK.
Cancel - 2, IDCANCEL.

For your dialog, x should work, unless you replace ret 1 to ret 0 under case 2.
#5
once i got the button assignment off of '2' the Alt-F4 and the Red "X" at the top right now operate as expected.

thanks again.
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 2 Guest(s)