IonicWind Software

IWBasic => General Questions => Topic started by: Andy on December 04, 2019, 05:11:35 AM

Title: Adding menu items
Post by: Andy on December 04, 2019, 05:11:35 AM
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.
Title: Re: Adding menu items
Post by: fasecero on December 04, 2019, 03:23:55 PM
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.
Title: Re: Adding menu items
Post by: Andy on December 05, 2019, 04:52:03 AM
Thanks,

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

Andy.
 :)