OpenWindow and CreateGadgetList combined

Share your advanced PureBasic knowledge/code with the community.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

OpenWindow and CreateGadgetList combined

Post by PB »

If you have an IncludeFile of favorite procedures (a bit like a pseudo-library)
then you can add this to it, and remove the need to type CreateGadgetList()
whenever you open a window. Plus, the new window has the added benefit
of having whatever default flags you like (eg. I like mine centered and with a
minimize button). Maybe this is useful for someone. :)

Code: Select all

Procedure MakeWindow(num,x,y,w,h,title$,flags=#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget)
  ProcedureReturn CreateGadgetList(OpenWindow(num,x,y,w,h,title$,flags))
EndProcedure

If MakeWindow(1,0,0,250,80,"Window title") ; No flags = centered + minimize button.
  TextGadget(1,20,30,200,20,"Example of embedded CreateGadgetList()")
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.