Skip to content

CreateMenu

Claude edited this page Oct 26, 2026 · 5 revisions

CreateMenu

Command Index · BlitzPlus · Menus

CreateMenu text$, menu_id%, parent_menu%  ; returns Int

Works in: BlitzPlus

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.

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)

CreateMenu

Parameter Type Default Description
text 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 Int required
parent_menu Int required

Returns: A handle for the menu.

Differences and known gaps:

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

Related commands

Command Index · BlitzPlus · Menus

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

Clone this wiki locally