Blitz3D+ Command Reference

CreateWindow ( text$,x,y,width,height[,group][,style] )

Parameters

text$ - title bar text

x,y - position of the window on the desktop, in logical units

width,height - outer size of the window

group (optional) - 0 creates an ordinary desktop-level window (default); passing an existing window makes the new one owned by it, so it stays in front of its owner - the usual arrangement for tool palettes

style (optional) - bit flags; 15 (default) combines caption, resizable, menu and status bar
bit 1: title bar with system menu (without it the window is a borderless popup)
bit 2: resizable frame with minimize/maximize buttons
bit 4: menu bar
bit 8: status bar
bit 16: tool window (slim title bar, no taskbar button)

Description

Creates a native window and returns its handle - the starting point of every GUI application.

Requires Extended language mode.

A window is the top-level gadget group: pass its handle as the group parameter of the other Create commands to fill it with buttons, lists, canvases and panels - every gadget belongs to a window, directly or through a group inside one. The handle is a positive, type-checked ID, the title text is UTF-8, and the window appears immediately.

The big thing to know: clicking the close box does not close anything. It posts a window-close event ($803) through the shared event queue, and your program decides what happens - typically confirm unsaved changes, then FreeGadget the window (which also frees every gadget in it) or simply end. Run a WaitEvent loop to receive this and every other event.

Geometry is in logical 96-DPI units with Per-Monitor V2 DPI handled for you. With style bit 8 the window has a status bar for SetStatusText; with bit 4 a menu bar you build via WindowMenu and CreateMenu. SetMinWindowSize stops the user shrinking your layout too far, and MinimizeWindow, MaximizeWindow and RestoreWindow drive the frame from code.

See it working in the window and button sample, and as a full editor shell in the world editor shell sample.

See also: FreeGadget, WaitEvent, WindowMenu, SetStatusText, SetMinWindowSize, ActivateWindow.

Index