Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check the condition before closing the dialog
#4
I added the same code for the CB control double-click event, But The dialog box cannot be closed by double click
Why?
    case CBN_DBLCLK<<16|5

Click the OK button, I can successfully check the input and close the dialog box



Macro Macro3
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 8 12 96 13 ""
;4 Edit 0x54030080 0x200 116 12 96 13 ""
;6 Edit 0x54230084 0x200 8 40 96 70 ""
;5 ComboBox 0x54230641 0x0 116 40 96 70 ""
;7 Static 0x54000000 0x0 8 0 48 12 "e3"
;8 Static 0x54000000 0x0 116 0 48 12 "e4"
;9 Static 0x54000000 0x0 8 28 48 13 "e6"
;10 Static 0x54000000 0x0 116 28 48 13 "cb5"
;11 Button 0x54032009 0x0 8 123 46 10 "male"
;12 Button 0x54002009 0x0 54 123 50 10 "female"
;13 Static 0x54000000 0x4 8 112 48 13 "Gender:[]"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "3 4 6 5 11 12"
str e3 e4 e6 cb5 o11mal o12fem

cb5="&one[]onee[]two[]three[]four[]five"
o11mal=1
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

out e3
out e4
out e6
out cb5
#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,_s.getwintext(id(3 hDlg)); _s.trim
,
,if(_s.len =0)
,,act id(3 hDlg) ;;e3 text
,,ret

,_s.getwintext(id(4 hDlg)) _s.trim
,
,if(_s.len =0)
,,act id(4 hDlg) ;;e4 text
,,ret

,_s.getwintext(id(6 hDlg)); _s.trim
,
,if(_s.len =0)
,,act id(6 hDlg) ;;e6 text
,,ret
,
,if(!IsDlgButtonChecked(hDlg 11))
,,if(!IsDlgButtonChecked(hDlg 12))
,,,out "check gender"
,,,ret
,
,case IDCANCEL
,
,case CBN_DBLCLK<<16|5
,_s.getwintext(id(3 hDlg)); _s.trim
,
,if(_s.len =0)
,,act id(3 hDlg) ;;e3 text
,,ret

,_s.getwintext(id(4 hDlg)) _s.trim
,
,if(_s.len =0)
,,act id(4 hDlg) ;;e4 text
,,ret

,_s.getwintext(id(6 hDlg)); _s.trim
,
,if(_s.len =0)
,,act id(6 hDlg) ;;e6 text
,,ret
,
,if(!IsDlgButtonChecked(hDlg 11))
,,if(!IsDlgButtonChecked(hDlg 12))
,,,out "check gender"
,,,ret
,

ret 1

Add the following code, can succeed
DT_Ok hDlg
Qm2 programming is really fun
Big Grin


Messages In This Thread
RE: Check the condition before closing the dialog - by macman - 01-15-2021, 12:49 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)