BarryG wrote: Tue Feb 10, 2026 9:50 am
That's okay for small simple menus, but not good for large menus with disabled text, icons, checkmarks, etc. You'd need to recreate all that, which is too much work. A cross-platform command to remove a menu item would be much better.
For lager Menus I have 2 ways to do:
1. Make a CreateMenu(Flags) or better spilt it into seperated CreatMenuTitle(Flags)
you have at least 32 Flags to hide different Menus, when creating.
Flags like: #mnu_LastFile01_Hide, #mnu_LastFile02_Hide
2. This a very new Methode and it exists at the moment only as a ProofOfConcept code
Creating the Menu directly from a DataSection:
That means: the comlete Menu is defined in a Datasection.
From there I create a ListStructure with all MenuEntries. Each entry has flags for Checked, Disabled, Hide
With the List I create the Menu and I can automatically create PureBasic Code for the Event Procs.
Now it is very easy to recreate complete MenuTitles with a new setting!
here the DataSection Example for the PB-IDE File Menu
Code: Select all
DataSection
mnuFile:
Data$ "mnuFile", "File"
Data$ "_New", "New", "[Ctrl+N]"
Data$ "_Open", "Open...", "[Ctrl+O]"
Data$ "_Save", "Save", "[Ctrl+S]"
Data$ "_SaveAs", "Save As..."
Data$ "_SaveAll", "Save All"
Data$ "_Reload", "Reload"
Data$ "_Close", "Close", "[Ctrl+W]"
Data$ "_CloseAll", "Close All"
Data$ "_ViewChanges", "View Changes"
Data$ "-"
Data$ "_ShowInFolder", "Show in Folder"
Data$ "-"
Data$ #LF$, "_FileFormat", "File Format"
Data$ "_EncodingPlainText", "Encoding: Plain Text"
Data$ "_EncodingUtf8", "Encoding Utf8"
Data$ "-"
Data$ "_NewLineCRLF", "Newline: Windows (CRLF)"
Data$ "_NewLineLF", "Newline: Linux (LF)"
Data$ "_NewlineCR", "Newline: MaxOS (CR)"
Data$ #CR$
Data$ "-"
Data$ "_Prferences", "Preferences..."
Data$ "-"
Data$ "_SessionHistory", "Session History"
Data$ #LF$, "_RecentFiles", "Recent Files"
Data$ "_File01", "File 1", "%\h"
Data$ "_File02", "File 2", "%\h"
Data$ "_File03", "File 3", "%\h"
Data$ "_File04", "File 4", "%\h"
Data$ "_File05", "File 5", "%\h"
Data$ "_File06", "File 6", "%\h"
Data$ "_File07", "File 7", "%\h"
Data$ "_File08", "File 8", "%\h"
Data$ "_File09", "File 9", "%\h"
Data$ "_File10", "File 10", "%\h"
Data$ #CR$
Data$ "-"
Data$ "_Quit", "Quit"
Data$ #EOT$
EndDataSection