|
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) bit 64: hidden until ShowGadget, which shows it complete |
|
Creates a native window and returns its handle - the starting point of every GUI application. 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 unless style bit 64 keeps it hidden. A window filled with many gadgets is seen to build itself, gadget by gadget. With style bit 64 it starts hidden instead: fill it out of sight, which is quicker too, then ShowGadget it (ActivateWindow also does). It appears complete and active, as a new window does. Until then SetWindowNormalPlacement, MaximizeWindow and RestoreWindow keep it hidden, and it appears as they left it. Show it just before drawing its canvases, and their first frame appears with it, once your program has handled the events that showing it produced and WaitEvent or PeekEvent finds none waiting. 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. |