Core Function GUICreateMenuItem
From Sputnik Wiki
GUICreate( "MenuItem", <gui object>, <Text> )
Contents |
Description
Create a MenuItem
Parameters
gui object
The GUI object to place the MenuItem on.
text
The text to display on the MenuItem.
Return Value
Success: Returns the new GUI object.
Failure: Returns 0 if error occurs.
Example
// Create the MDI GUI Global $GUI = GUICreate("MDIWindow", "Test GUI", 800, 600); // Show the MDI GUI GUILoad( $GUI ); // Create Menu BELOW // First create the menu object $MainMenu = GUICreate("Menu", $GUI, $mFile); // Create "File" part of the menu $mFile = GUICreate("MenuItem", $MainMenu, "File"); $mFileNew = GUICreate("MenuItem", $mFile, "New Project"); $mFileSave = GUICreate("MenuItem", $mFile, "Save Project"); $mFileLoad = GUICreate("MenuItem", $mFile, "Load Project"); $mFileClose = GUICreate("MenuItem", $mFile, "Close Project"); $mFileSPP = GUICreate("MenuItem", $mFile, "-"); $mFileExit = GUICreate("MenuItem", $mFile, "Exit Program"); // Create "Objects" part of the menu $mObjects = GUICreate("MenuItem", $MainMenu, "Add Objects"); // Create "Project" part of the menu $mProject = GUICreate("MenuItem", $MainMenu, "Project"); $mProjectBuild = GUICreate("MenuItem", $mProject, "Build EXE"); $mProjectTest = GUICreate("MenuItem", $mProject, "Test"); $mProjectWindowManager = GUICreate("MenuItem", $mProject, "Window Manager"); $mProjectSPP = GUICreate("MenuItem", $mProject, "-"); // Create "Settings" part of the menu $mSettings = GUICreate("MenuItem", $MainMenu, "Settings"); $mSettingsGlobal = GUICreate("MenuItem", $mSettings, "Change Global Settings"); $mSettingsProject = GUICreate("MenuItem", $mSettings, "Change Project Settings"); // Create "About" part of the menu $mAbout = GUICreate("MenuItem", $MainMenu, "About"); $mAboutIDE = GUICreate("MenuItem", $mAbout, "About Sputnik IDE"); // Set links to the MENU GUILink($mFileNew, "Click", 'msgbox("NEW PROJECT");'); GUILink($mFileLoad, "Click", 'msgbox("LOAD PROJECT");'); GUILink($mFileExit, "Click", 'Exit();'); // Finally assign the menu to the window GUISetProp($GUI, "Menu", $MainMenu); // Create Menu ABOVE // Keep the GUI running as long as long as the window is open While ( GUIStatus( $GUI ) ) DoEvents( );