Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exporting a Menu
#1
Hello again!

So I've been using quick macros a lot this days and I'm creating macros that are helping me a lot!

I have a doubt about menus now. I understand that you cannot export a menu into a .exe and that you have to create a macro to run a function that will run the menu. The thing is, I don't really know how to do it so I went searching online for help. And I found this function:

Code:
Copy      Help
\
function# $template [$tempitemname] [sync]

Shows popup menu created at run time.
Replaces every {menuname} in template text with submenu created
   from a menu (QM item) whose name is menuname.
{menuname} must be at the beginning of a line. It can be preceded
   by tabs. If it is followed by more text in the same line, the
   menu name is not inserted.
If menu menuname does not exist, removes the line.

template - menu text (if multiline), or existing menu name (if single line).
tempitemname - the name of the temporary menu. Default: "temp_menu".
sync - if nonzero, waits and returns 1-based index of selected line.


str s sn st sr si; int i
ARRAY(CHARRANGE) a

if(findc(template 10)<0) s.getmacro(template)
else s=template

if(findrx(s "^\t*\{(.+?)\}([^[]]*)$" 0 12 a))
    for i a.len-1 -1 -1
        CHARRANGE r(a[0 i]) rn(a[1 i]) ri(a[2 i])
        sn.get(s rn.cpMin rn.cpMax-rn.cpMin)
        st.getmacro(sn); err s.remove(r.cpMin r.cpMax-r.cpMin+2); continue
        st.rtrim("[]")
        if(ri.cpMax>ri.cpMin) si.get(s ri.cpMin ri.cpMax-ri.cpMin); sn=""; else si=""
        sr.format(">%s%s[]%s[]<" sn si st)
        s.replace(sr r.cpMin r.cpMax-r.cpMin)

out s
ret DynamicMenu(s tempitemname sync)
err+ end _error

Then I created a macro to run this function and whenever I try to create an .exe from this macro I get this error:

Error in DynamicMenu: cannot be used in exe.
Cannot make exe. Error 4, failed to compile.

Can anybody help me with this?

Thank you so much for your time!
#2
In exe cannot be used usual QM menus as well as this function.
Instead use function ShowMenu or class MenuPopup. It shows standard menu without icons.
#3
I don't think this is the function I'm looking for.
From the QM help I found that this function doesn't work with a "Menu Item".

Am I wrong?

I'm sorry but I'm really at a loss here :?
#4
ShowMenu doesn't use QM items of type "Menu". That is why it works in exe. Your code and anything that uses QM items of type "Menu" will not work in exe.
#5
Really? So this awesome menu that I created won't work outside QM?
#6
Won't work.
It's possible to add icons to ShowMenu menus. But they don't support some QM menu features eg "expand file folders".
#7
Dammit so I have to re-do all this work !

I wish I knew that sooner.

Thanks for your help though ! I appreciate
#8
Just because you mentioned, I would like to know how could I insert an icon on a MenuPopup.
I searched but all I can find is a tray icon.

Thank you so much one more time!
#9
Menu icons
#10
Wonderful !

Thanks a bunch


Forum Jump:


Users browsing this thread: 1 Guest(s)