March 29, 2024, 02:28:50 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Adding menu items

Started by Andy, December 04, 2019, 05:11:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

I'm about to release the very fast new version of my program to convert IW keywords to upper / lowercase, but I have a question (as always).

An option I've added in is the ability to quickly create a basic window, send it to the clipboard ready for you to paste into a new file or code - saves a lot of time and I've already found it handy.

BUT - there may be other tools you want to add into my programs "Tools" menu (menu options), and the question is this:

How do I (or my program that is) know how many tools you've added, and if you add a new one how to I get the program to select it and run it.

Example:

BEGINMENU w1
    MENUTITLE "&File"
        MENUITEM "Quit",0,MenuQuit
    MENUTITLE "Tools"
        MENUITEM "Create a window",0,MenuWindow
        MENUITEM "Create a dialog",0,MenuDialog
        MENUITEM "Create a console",0,MenuConsole
    MENUTITLE "Options"
        MENUITEM "Change options",0,MenuChange
ENDMENU

How would I add in a new

MENUITEM "Your tool",0,"your control"

and add this into the window's handler?

          CASE @IDMENUPICK
                SELECT @MENUNUM
                      CASE MenuWindow
                            DoThis..........


LarryMc's IDE can do it, so any ideas anyone please?

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

You can implement something like this

CONST toolbaseID = 100 ' tool starting number/id
INT toolCount = 0 ' menuitems tools number you currently have

increase toolCount by 1 each time a new tool is added and call

ADDMENUITEM (w1, 1, "new tool", 0, toolBaseID + toolCount)
when you save the tools to a file, save toolCount too.

Andy

Thanks,

That's one way of doing it, will have a look!

Andy.
 :)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.