Page 1 of 1

OpenWindow and CreateGadgetList combined

Posted: Sun Jun 17, 2007 4:30 am
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