Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merge the code for the two dialog functions
#2
use the v attribute with  sub.right_menu then can access the t variable in the subfunction
 
Code:
Copy      Help
str t="A"

str dd=
F
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "{t}_Dialog" "4"
;3 Edit 0x54030080 0x200 68 52 96 13 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str e3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SetWindowSubclass(id(3 hDlg) &sub.WndProc_Subclass_Edit 3 0)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub WndProc_Subclass_Edit ;;Edit
function# hwnd message wParam lParam uIdSubclass dwRefData

;OutWinMsg message wParam lParam ;;uncomment to see received messages
sel message
,case WM_CONTEXTMENU
,sub.right_menu hwnd
,ret

int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass_Edit uIdSubclass)
ret R

#sub right_menu v
function hwnd
str s=
F
;1 1    {t} test1
;2 2    {t} test2
;3 3    {t} test3

MenuPopup m.AddItems(s)
int i=m.Show
str s1 s2
if(i and m.GetItemText(i s1 s2))
,EditReplaceSel hwnd 0 s2 1|2|4


Messages In This Thread
RE: Merge the code for the two dialog functions - by Kevin - 12-26-2022, 11:52 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)