07-23-2017, 07:00 AM
Macro Macro2884
\Dialog_Editor
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 146 116 "Dialog"
;100 Button 0x54030001 0x4 20 92 48 14 "OK"
;2 Button 0x54030000 0x4 80 92 48 14 "Cancel"
;3 Edit 0x54231044 0x200 24 40 96 48 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""
str controls = "3"
str e3
e3=
;ONE
;TWO
;THREE
;
if(!ShowDialog(dd &sub.DlgProc &controls )) ret
#sub DlgProc
function# hDlg message wParam lParam
opt keysync 1 ;;don't need key synchronization for sending keys to windows of this thread
sel message
,case WM_INITDIALOG
,act id(3 hDlg) ;;focus the edit control. Note: in the dialog definition it must not be the first control.
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 100
,act id(3 hDlg) ;;focus the edit control
,key H SE ;;select current line
,str pc.getsel ;;get its text
,if(pc.len=0) ret
,key HD ;;next line
,
,;run macro and wait
,opt waitmsg 1 ;;keep the dialog responsive
,wait 0 H mac("sub.Macro" "" pc)
ret 1
#sub Macro
function str'pc
spe -1
mes pc