SysMenuText Property, SysMenuOver Event

Purpose

Returns or sets the text displayed for the system menu of a Form.

Syntax

Form.SysMenuText(idx%) [ = txt ]

Sub Form_SysMenuOver([index%,] idx% )

txt:sexp
index%:iexp, Form number
idx%:iexp, menu item identifier

Description

The window menu (also known as the System menu or Control menu) is a pop-up menu defined and managed almost exclusively by the operating system. The user can open the window menu by clicking the application icon on the title bar or by right-clicking anywhere on the title bar.

The window menu provides a standard set of menu items that the user can choose to change a window's size or position, or close the application. Items on the window menu can be added, deleted, and modified, but most applications just use the standard set of menu items.

The window menu initially contains items with various identifier values, such as SC_CLOSE, SC_MOVE, and SC_SIZE. These command identifiers are used as the parameter in SysMenuText() to modify the text.

When the mouse hovers over the items in the window menu, GFA-BASIC 32 invokes the SysMenuOver event passing the identifier in the idx% argument.

This parameter can be one of the following values:

SC_CLOSE Closes the window.
SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.
SC_DEFAULT Selects the default item; the user double-clicked the window menu.
SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.
SC_HSCROLL Scrolls horizontally.
SC_KEYMENU Retrieves the window menu as a result of a keystroke.
SC_MAXIMIZE Maximizes the window.
SC_MINIMIZE Minimizes the window.
SC_MONITORPOWER   Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
lParam can have the following values:
1 means the display is going to low power.
2 means the display is being shut off.
SC_MOUSEMENU Retrieves the window menu as a result of a mouse click.
SC_MOVE Moves the window.
SC_NEXTWINDOW Moves to the next window.
SC_PREVWINDOW Moves to the previous window.
SC_RESTORE Restores the window to its normal position and size.
SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE Sizes the window.
SC_TASKLIST Activates the Start menu.
SC_VSCROLL Scrolls vertically.

All predefined window menu items have identifier numbers greater than 0xF000. If an application adds commands to the window menu, it should use identifier numbers less than 0xF000.

Example

OpenW 1, 10, 10, 300, 300

Ocx StatusBar stb

Win_1.SysMenuText(SC_MINIMIZE) = "Hello"

Do

Sleep

Until Win_1 Is Nothing

 

Sub Win_1_SysMenuOver(idx%)

If idx% = 0

stb.SimpleText = ""

Else

stb.SimpleText = "System menu idx = 0x" & Hex(idx)

EndIf

EndSub

Replaces Minimize by Hello and shows the identifier in the status bar.

See Also

Form

{Created by Sjouke Hamstra; Last updated: 24/10/2014 by James Gaite}