02-14-2023, 04:06 PM
If there are multiple QM_ComboBox controls, How to judge?
Macro Macro5
Macro Macro5
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 120 174 "Dynamic Dialog"
;3 Edit 0x54030080 0x200 8 8 104 14 "" "1 help txt"
;4 Edit 0x54030080 0x204 8 32 104 14 "" "2 help txt"
;5 QM_ComboBox 0x54030242 0x0 8 60 96 13 "" "3 help txt"
;6 QM_ComboBox 0x54030242 0x4 8 88 96 13 "" "4 help txt"
;7 QM_ComboBox 0x54030242 0x4 8 116 96 13 "" "5 help txt"
;1 Button 0x54030001 0x4 16 152 40 14 "OK"
;2 Button 0x54030000 0x0 64 152 40 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "" "" "" ""
str controls = "3 4 5 6 7"
str e3 e4 qmcb5 qmcb6 qmcb7
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,int i; ARRAY(str) as; tok(controls as)
,for _i 0 as.len
,,i=val(as[_i])
,,_s.getwintext(id(i hDlg)); _s.trim
,,int cid=id(i hDlg)
,,if empty(_s)
,,,if i=5
,,,,i=1001
,,,act cid
,,,sub.SetEditBallonTip(i hDlg)
,,,ret
,case IDCANCEL
ret 1
#sub SetEditBallonTip
function cid hwnd
EDITBALLOONTIP ebt
ebt.cbStruct=sizeof(ebt)
ebt.pszTitle=@"ERR"
ebt.ttiIcon=TTI_ERROR
ebt.pszText=@"Can't be empty"
SendMessage(id(cid hwnd) EM_SHOWBALLOONTIP 0 &ebt)