Modal windows with PB4

Share your advanced PureBasic knowledge/code with the community.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Modal windows with PB4

Post 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
Last edited by Joakim Christiansen on Sun May 21, 2006 10:34 pm, edited 1 time in total.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: Modal windows with PB4

Post by NoahPhense »

Nice.. sticky .. heh

- np
Post Reply