02-08-2023, 06:04 AM
Thanks for your help, I still don't understand some of the code
I need the SCI editor code as a single function, and I have multiple edit box controls.
Modify the text in the currently active edit box, How do I pass parameters?
Macro Multi_editbox
Function Sci_Editor
I need the SCI editor code as a single function, and I have multiple edit box controls.
Modify the text in the currently active edit box, How do I pass parameters?
Macro Multi_editbox
int sci
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 286 "Dialog" "4"
;3 Edit 0x54231044 0x200 8 8 208 80 ""
;4 Button 0x54032000 0x0 16 264 74 14 "Sci_Editor(Alt+A)"
;5 Edit 0x54231044 0x204 8 96 208 72 ""
;6 Edit 0x54231044 0x204 8 176 208 80 ""
;1 Button 0x54030001 0x4 112 264 48 14 "OK"
;2 Button 0x54030000 0x4 168 264 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""
str controls = "3 5 6"
str e3 e5 e6
e3=
;hello world 1
;thank you for your help 1
e5=
;hello world 2
;thank you for your help 2
e6=
;hello world 3
;thank you for your help 3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,DT_SetAccelerators(hDlg "401 Aa")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_APP+10 ;;receive text from child dialog
,str& txt=+lParam
,txt.setwintext(id(3 hDlg))
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case [4 401];;Sci_Editor
,Sci_Editor(hDlg)
ret 1
Function Sci_Editor
function# [hwndOwner]
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 346 206 "Dialog" "4"
;3 Scintilla 0x54000000 0x20000 0 0 346 184 ""
;1 Button 0x54030001 0x4 232 188 48 14 "OK"
;2 Button 0x54030000 0x4 288 188 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""
ShowDialog(dd &sub.DlgProc_Sci 0 hwndOwner)
#sub DlgProc_Sci v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,sci=id(3 hDlg)
,str text
,text.getwintext(id(3 GetParent(hDlg)))
,sub.SetText(text)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,sub.GetText(text)
,SendMessage GetParent(hDlg) WM_APP+10 hDlg &text
,case IDCANCEL
ret 1
#sub Sci v
function# message [param1] [param2]
ret SendMessage(sci message param1 param2)
#sub Sci2 v
function# message [param1] [$text]
ret SendMessage(sci message param1 text)
#sub GetText v
function str&text
int n=SendMessage(sci SCI.SCI_GETTEXTLENGTH 0 0)
text.fix(SendMessage(sci SCI.SCI_GETTEXT n+1 text.all(n)))
#sub SetText v
function $text
sub.Sci2(SCI.SCI_SETTEXT 0 text)