Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menu in RTF (with right click of mouse)
#1
Could you show me an example of how to get a popup menu when I press the right mouse button in the RTF field of my EXE? Nothing I do seams to work and I need to use a RTF because of all the dragging and dropping.

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

str controls = "3"
str rea3
if(!ShowDialog("MyDialogWithMenu" &MyDialogWithMenu &controls 0 0 0 0 0 0 0 "dialog.ico" "MyDialogWithMenu")) ret

;BEGIN DIALOG
;0 "" 0x10CF0A44 0x100 0 0 294 190 "Dialog"
;3 RichEdit20A 0x54233044 0x101 0 0 294 190 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020009 "*" ""

ret
;messages
sel message
,case WM_INITDIALOG
,
,case WM_SIZE
,RECT r; GetClientRect(hDlg &r)
,siz r.right r.bottom id(3 hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,;menu items:
,case 101    ;; Menu File>>Open
,,str s fileTxt
,,if OpenSaveDialog(0 s "Text files[]*.txt[]Image files[]*.bmp;*.gif[]All Files[]*.*[]")
,,,fileTxt.getfile(s)
,,,fileTxt.setwintext(id(3 hDlg))
,case 103 out "Cut"
,case 104 out "Select All"
,case 105 out "Help"
,
,case IDOK
,case IDCANCEL
ret 1

;BEGIN MENU
;>&File
,;&Open : 101 0 0 Co
,;-
,;>&Recent
,,;Empty : 102 0 3
,,;<
,;<
;>&Edit
,;Cu&t : 103 0 0 Cx
,;-
,;Select &All : 104 0 0 Ca
,;<
;&Help : 105 0
;END MENU
#2
You can do it using filter functions and menus from what i know...

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

str controls = "3"
str rea3
if(!ShowDialog("MyDialogWithMenu" &MyDialogWithMenu &controls 0 0 0 0 0 0 0 "dialog.ico" "MyDialogWithMenu")) ret

;BEGIN DIALOG
;0 "" 0x10CF0A44 0x100 0 0 294 190 "Dialog"
;3 RichEdit20A 0x54233044 0x101 0 0 294 190 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020009 "*" ""

ret
;messages
sel message
,case WM_INITDIALOG
,
,case WM_SIZE
,RECT r; GetClientRect(hDlg &r)
,siz r.right r.bottom id(3 hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,;menu items:
,case 101 ;; Menu File>>Open
,,str s fileTxt
,,if OpenSaveDialog(0 s "Text files[]*.txt[]Image files[]*.bmp;*.gif[]All Files[]*.*[]")
,,,fileTxt.getfile(s)
,,,fileTxt.setwintext(id(3 hDlg))
,case 103 out "Cut"
,case 104 out "Select All"
,case 105 out "Help"
,
,case IDOK
,case IDCANCEL
ret 1

;BEGIN MENU
;>&File
,;&Open : 101 0 0 Co
,;-
,;>&Recent
,,;Empty : 102 0 3
,,;<
,;<
;>&Edit
,;Cu&t : 103 0 0 Cx
,;-
,;Select &All : 104 0 0 Ca
,;<
;&Help : 105 0
;END MENU

Function FF_Menu1
Code:
Copy      Help
;/
;Allows starting macro when mouse pointer is on certain control.

function# iid FILTER&f

int controlid = 3 ;;change control id

if(!f.hwnd2) ret
if(!wintest(f.hwnd "Dialog" "#32770")) ret ;;change window name and class
if(GetWinId(f.hwnd2)=controlid) ret iid

Menu
Trigger #R //FF_Menu1     Help - how to add the trigger to the macro
Code:
Copy      Help
Example...
Example...
#3
Function MyDialogWithMenu
Code:
Copy      Help
,case WM_COMMAND goto messages2
,
,case WM_CONTEXTMENU
,sel GetWinId(wParam)
,,case 3
,,out PopupMenu("1[]2[]3")
,
#4
Thank you both. I decided to use Gintaras example because it will work in EXE


Forum Jump:


Users browsing this thread: 1 Guest(s)