OpenWindow()

Syntax

Result = OpenWindow(#Window, x, y, InnerWidth, InnerHeight, Title$ [, Flags [, ParentWindowID]])
Description
Opens a new window according to the specified parameters. The new window becomes the active window, it's not needed to use SetActiveWindow() (unless the window is created as invisible).

Parameters

#Window A number to identify the new window. #PB_Any can be used to auto-generate this number.
x, y The initial position of the window, in pixels (unless one of the center flags is used). If 'x' or 'y' is set to #PB_Ignore, the OS will choose a position for the window.
InnerWidth, InnerHeight The required client area, in pixels (without borders and window decorations).
Title$ The title of the newly created window.
Flags (optional) Can be a combination of the following values:
  #PB_Window_SystemMenu    : Enables the system menu on the window title bar (default).
  #PB_Window_MinimizeGadget: Adds the minimize gadget to the window title bar. #PB_Window_SystemMenu is automatically added.
  #PB_Window_MaximizeGadget: Adds the maximize gadget to the window title bar. #PB_Window_SystemMenu is automatically added.
                             (MacOS only: #PB_Window_SizeGadget will be also automatically added).
  #PB_Window_SizeGadget    : Adds the sizeable feature to a window.
  #PB_Window_Invisible     : Creates the window but don't display.
  #PB_Window_TitleBar      : Creates a window with a titlebar.
  #PB_Window_Tool          : Creates a window with a smaller titlebar and no taskbar entry. 
  #PB_Window_BorderLess    : Creates a window without any borders.
  #PB_Window_ScreenCentered: Centers the window in the middle of the screen. x,y parameters are ignored.
  #PB_Window_WindowCentered: Centers the window in the middle of the parent window ('ParentWindowID' must be specified).
                                             x,y parameters are ignored.
  #PB_Window_Maximize      : Opens the window maximized. (Note: on Linux, not all Windowmanagers support this)
  #PB_Window_Minimize      : Opens the window minimized.
  #PB_Window_NoGadgets     : Prevents the creation of a GadgetList. UseGadgetList() can be used to do this later.
  #PB_Window_NoActivate    : Don't activate the window after opening.
ParentWindowID (optional) The WindowID the new window belongs to. 'ParentWindowID' value can be easily obtained with WindowID().

Return value

Nonzero if the window was successfully created, zero otherwise. If #PB_Any was used for the #Window parameter then the generated number is returned on success.

Remarks

All possible events in a window are handled with the WindowEvent() and WaitWindowEvent() functions.

Windows only: for special situations callbacks are used, see description at SetWindowCallback(). On Windows, the height and width of a window with a titlebar can't be less than around 100 pixels. To open smaller windows, use the "#PB_Window_BorderLess" flag.

Important: A window should not be opened in a thread, as there is some limitation on OS X and Linux. A debugger error will be raised.

See Also

CloseWindow()

Supported OS

All

<- IsWindow() - Window Index - PostEvent() ->