func_maxgui_windows_createwindow.rst 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .. _func_maxgui_windows_createwindow:
  2. ============
  3. CreateWindow
  4. ============
  5. CreateWindow -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. CreateWindow:TGadget( titletext$,x,y,w,h,group:TGadget=Null,style=15 )
  10. Create a Window gadget.
  11. A Window is the primary gadget of MaxGUI. Windows should be used as the primary
  12. group gadgets in MaxGUI applications to contain the gadgets that make up the program's
  13. user interface.
  14. The following style flags are supported when creating a Window. Any of the
  15. style flags can be combined using the bitwise operator '|'.
  16. [ @Style | @Meaning
  17. * WINDOW_TITLEBAR | The Window has a titlebar that displays the @titletext$.
  18. * WINDOW_RESIZABLE | The Window can be resized by the user.
  19. * WINDOW_MENU | The Window has a menubar (required if you wish to add menus to a Window).
  20. * WINDOW_STATUS | The Window has a statusbar.
  21. * WINDOW_TOOL | The Windows will look and behave like a floating window.
  22. * WINDOW_CLIENTCOORDS | The dimensions specified relate to the client area as opposed to the window frame.
  23. * WINDOW_CENTER | The x and y values are ignored, and the Window is positioned either in the middle of the screen or the middle of the parent gadget.
  24. * WINDOW_HIDDEN | The Window is created in a hidden state and can be revealed later using #ShowGadget.
  25. * WINDOW_ACCEPTFILES | Enable file drag and drop operations (emits the EVENT_WINDOWACCEPT events).
  26. ]
  27. Note: For cross-platform projects, it is highly recommended that the WINDOW_CLIENTCOORDS style is used to maintain
  28. similar layouts with different operating systems.
  29. The default window style (15) is equivalent to WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_MENU | WINDOW_STATUS.
  30. A Window emits the following events:
  31. [ @{Event ID} | @Description
  32. * EVENT_WINDOWMOVE | Window has been moved.
  33. * EVENT_WINDOWSIZE | Window has been resized.
  34. * EVENT_WINDOWCLOSE | Window close icon clicked.
  35. * EVENT_WINDOWACTIVATE | Window activated.
  36. * EVENT_WINDOWACCEPT | A file was dropped onto a Window with the WINDOW_ACCEPTFILES style. The Event Extra object holds the filepath.
  37. ]
  38. See Also: #WindowMenu, #UpdateWindowMenu, #PopupWindowMenu, #ActivateWindow, #SetStatusText,
  39. #SetMinWindowSize, #SetMaxWindowSize, #MinimizeWindow, #MaximizeWindow, #RestoreWindow, #WindowMinimized
  40. and #WindowMaximized.
  41. Parameters
  42. ==========
  43. Return Values
  44. =============
  45. Nothing.
  46. Examples
  47. ========
  48. .. code-block:: blitzmax
  49. ' createwindow.bmx
  50. Import MaxGui.Drivers
  51. Strict
  52. Local window:TGadget
  53. window=CreateWindow("My Window",40,40,320,240)
  54. While True
  55. WaitEvent
  56. Print CurrentEvent.ToString()
  57. Select EventID()
  58. Case EVENT_WINDOWCLOSE
  59. End
  60. End Select
  61. Wend
  62. See Also
  63. ========