Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Recent Files" menu in a dialog
#1
Function dlg_recent_menu_sample
Code:
Select All      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dlg_recent_menu_sample" &dlg_recent_menu_sample 0 0 0 0 0 0 0 0 "" "dlg_recent_menu_sample")) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030009 "*" "" ""

ret
;messages
#compile CRecentMenu
CRecentMenu-- t_rm

sel message
,case WM_INITDIALOG
,t_rm.Init(hDlg 1000 4 "\test\test")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,
,case WM_INITMENUPOPUP
,if(t_rm.OnWmInitmenupopup(wParam))
,,AppendMenuW t_rm.hsubmenu MF_SEPARATOR 0 0
,,AppendMenuW t_rm.hsubmenu 0 99 @"Clear"
ret
;messages2
str sf
sel wParam
,case 101 ;;Open
,if(!OpenSaveDialog(0 sf)) ret
,;g1
,t_rm.AddFile(sf)
,
,case [1000,1001,1002,1003]
,if(!t_rm.GetSelectedFile(wParam sf)) ret
,out sf
,goto g1
,
,case 99 ;;Clear
,t_rm.RemoveAll
,
,case 901
,ARRAY(str) a
,t_rm.GetFiles(a)
,out a
,
,case IDOK
,case IDCANCEL
ret 1

;BEGIN MENU
;>&File
,;&Open : 101 0 0 Co
,;-
,;&Recent : 1000
,;-
,;E&xit : 2 0 0 AF4
,;<
;>&Edit
,;Empty : 201 0 1
,;<
;>&View
,;Empty : 301 0 1
,;<
;&Help : 401 0
;-
;>&Test
,;GetFiles : 901
,;<
;END MENU


Attached Files
.qml   CRecentMenu.qml (Size: 3.92 KB / Downloads: 312)
#2
i can't get this running as exe.

Function CRecent
Code:
Select All      Help
;/exe
if(!ShowDialog("dlg_recent_menu_sample" &dlg_recent_menu_sample)) ret

the menu toolbar does not show up.
   
pi
#3
do those have to be declared for exe?

AppendMenuW t_rm.hsubmenu MF_SEPARATOR 0 0
AppendMenuW t_rm.hsubmenu 0 99 @"Clear"

#AppendMenuW hMenu uFlags uIDNewItem @*lpNewItem

dll user32 #AppendMenuW ? ? ? ?
pi
#4
dlg_recent_menu_sample must be in exe project folder.
Or pass menu definition string to ShowDialog instead of function name.
#5
Gintaras Wrote:dlg_recent_menu_sample must be in exe project folder.

it was already there.
now dlg_recent_menu_sample is renamed to CRecentDialog.

***
please allow .ico as attachment


Attached Files
.qml   CRecent.qml (Size: 4.36 KB / Downloads: 301)
pi
#6
Your dialog code is without menu argument.

Macro
Code:
Select All      Help
;/exe
;if(!ShowDialog("dlg_recent_menu_sample" &dlg_recent_menu_sample)) ret
;->
if(!ShowDialog("dlg_recent_menu_sample" &dlg_recent_menu_sample 0 0 0 0 0 0 0 0 "" "dlg_recent_menu_sample")) ret


Forum Jump:


Users browsing this thread: 1 Guest(s)