Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modal Windows display and return text
#7
can simplify it some get rid of the global variable...
Macro Macro6
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 286 "Dialog" "4"
;3 Edit 0x54231044 0x200 8 8 208 80 ""
;5 Edit 0x54231044 0x204 8 96 208 72 ""
;6 Edit 0x54231044 0x204 8 176 208 80 ""
;4 Static 0x54000001 0x0 16 266 74 14 "Sci_Editor(Alt+A)"
;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
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case [401] ;;Alt+A
,int hc=GetFocus
,act hc
,_s.getsel
,if empty(_s)
,,_i=1
,,_s.getwintext(hc)
,if Sci_Editor(hDlg _s)
,,if _i
,,,_s.setwintext(hc)
,,else
,,,act hc
,,,_s.setsel
ret 1

Function Sci_Editor
Code:
Copy      Help
function# [hwndOwner] [~&txt]
int sci
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 "*" "" "" ""

str contrls="3"
str s3
if(!ShowDialog(dd &sub.DlgProc_Sci &contrls hwndOwner)) ret
txt=s3
ret 1
#sub DlgProc_Sci v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,sci=id(3 hDlg)
,sub.SetText(txt)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub Sci2 v
function# message [param1] [$text]
ret SendMessage(sci message param1 text)

#sub SetText v
function $text
sub.Sci2(SCI.SCI_SETTEXT 0 text)


Messages In This Thread
RE: Modal Windows display and return text - by Kevin - 02-08-2023, 10:50 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)