Page 1 of 1

Modal windows with PB4

Posted: Wed Feb 08, 2006 1:24 pm
by Joakim Christiansen
Code updated For 5.20+

Just a simple example to show this nice new feature in PB4! :wink:

Code: Select all

OpenWindow(0,0,0,300,300,"Main Window",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

ButtonGadget(0,10,10,100,20,"Show other window")

Procedure OtherWindow()
  OpenWindow(1,0,0,200,200,"Other Window",#PB_Window_WindowCentered,WindowID(0))
  
  ButtonGadget(1,10,10,100,20,"Close window")
EndProcedure

Repeat
  WindowEvent = WaitWindowEvent()
  
  Select WindowEvent
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 0
          OtherWindow()
          DisableWindow(0,#True)
          StickyWindow(1,#True)
        Case 1
          CloseWindow(1)
          DisableWindow(0,#False)
          SetActiveWindow(0)
      EndSelect
  EndSelect
Until WindowEvent = #PB_Event_CloseWindow

Re: Modal windows with PB4

Posted: Wed Feb 08, 2006 3:03 pm
by NoahPhense
Nice.. sticky .. heh

- np