Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting a default value in a dialog box
#7
If the macro with the dialog definition (text between BEGIN DIALOG and END DIALOG) is encrypted, you need to assign the dialog definition to a variable, pass the variable to ShowDialog as first argument, and include 2 in flags. Example:

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

lpstr dd=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032009 0x0 6 6 48 12 "Option first"
;4 Button 0x54002009 0x0 6 20 48 13 "Option next"
;5 Button 0x54002009 0x0 6 34 48 12 "Option next"
;6 Button 0x54002009 0x0 6 48 48 12 "Option next"
;7 Edit 0x54030080 0x200 58 48 96 14 ""
;8 Button 0x54032000 0x0 6 116 48 14 "Security"
;END DIALOG
;DIALOG EDITOR: "" 0x2010805 "" ""


str controls = "3 4 5 6 7"
str o3Opt o4Opt o5Opt o6Opt e7
o3Opt=1
int secure=1 ;;set to 0 if nonsecure
if(!ShowDialog(dd &Dialog5545 &controls 0 2 0 0 secure)) ret

ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,int secure2=DT_GetParam(hDlg)
,if(secure2) EnableWindow(id(8 hDlg) 0)
,ret 1
,
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
secure2=DT_GetParam(hDlg)
sel wParam
,case 8 ;;Security clicked
,if(!secure2)
,,mes "nonsecure"
,,;...
,
,case EN_SETFOCUS<<16|7 ;;the text box focused
,CheckRadioButton hDlg 3 6 6
,;this also can be used: but id(6 hDlg); act lParam
,
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)