Skip to content

CreateMenu

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions
BlitzPlus

CreateMenu

CreateMenu:Int32 text:String, menu_id:Int32, parent_menu:Int32
Parameter Mode Type Default Description
text In String required Text of the title or item. Put & before a letter to underline it for the keyboard. An empty text is a separator.
menu_id In Int32 required
parent_menu In Int32 required

Returns: A handle for the menu.

Description

Makes a menu title or a menu item. Give WindowMenu as the parent to get a title in the menu bar, and a menu as the parent to put an item or a submenu into it. An item that has items of its own opens a submenu. Choosing an item sends a $1001 event whose EventData is the number you gave. An empty text makes a separator line.

Call UpdateWindowMenu once you are done changing menus. The window needs flag 4 in its style to have room for the menu bar.

Differences

  • The shortcut underline for & is accepted but menus are only used with the mouse and the arrow keys.

Examples

Graphics 320, 240, 32, 2
win  = CreateWindow("Editor", 10, 10, 300, 170, Desktop(), 15)
file = CreateMenu("File", 0, WindowMenu(win))
CreateMenu "New", 1, file
CreateMenu "", 0, file
CreateMenu "Quit", 2, file
UpdateWindowMenu win
Repeat
	e = WaitEvent()
	If e = $1001 Then SetStatusText win, "Menu " + EventData()
Until e = $803 Or (e = $1001 And EventData() = 2)

Media

CreateMenu

Related Commands

CheckMenu, DisableMenu, EnableMenu, MenuChecked, MenuEnabled, MenuText, SetMenuText, UncheckMenu

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally