How to create a blocking input requester

Just starting out? Need help? Post your questions and find answers here.
davidow
New User
New User
Posts: 5
Joined: Mon Mar 20, 2023 7:34 am
Location: Uttoxeter, UK

How to create a blocking input requester

Post by davidow »

Could some, please, advise me if there is a way by using a window created with the dialog.
I need to display a lot more lines of information to enable a choice to be made.

Input Requester only allows a simple one-liner.
User avatar
mk-soft
Always Here
Always Here
Posts: 6206
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: How to create a blocking input requester

Post by mk-soft »

Create a second window as dialog and DisableWindow the main window if open
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: How to create a blocking input requester

Post by RASHAD »

Search the forum for Property Box
Egypt my love
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: How to create a blocking input requester

Post by RASHAD »

Quick sample
Using Modal Window

Code: Select all

OpenWindow(0,0,0,300,300,"Main Window",#PB_Window_ScreenCentered|#PB_Window_SystemMenu) 
ButtonGadget(0,10,10,65,20,"Options") 
Repeat 
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Quit = 1      
      
    Case #PB_Event_Gadget 
      Select EventGadget() 
        Case 0 
          OpenWindow(1,0,0,200,200,"Modal Window",#PB_Window_WindowCentered,WindowID(0))
          UseGadgetList(WindowID(1))
          TextGadget(1,10,10,120,20,"Pick your Mode :")
          SpinGadget(2,135,10,45,20,1,10,#PB_Spin_Numeric)
          SetGadgetState(2,4)
          TextGadget(3,10,40,120,20,"Are you sure ?")
          OptionGadget(4,135,40,50,20,"YES")
          OptionGadget(5,135,65,50,20,"NO")
          SetGadgetState(4,1) 
          ButtonGadget(100,10,175,60,20,"OK") 
          DisableWindow(0,#True) 
        Case 100 
          CloseWindow(1) 
          DisableWindow(0,#False) 
          SetActiveWindow(0) 
      EndSelect
    Case #PB_Event_CloseWindow
      Select EventWindow() 
        Case 0
          Break
      EndSelect
  EndSelect 
Until Quit = 1
Egypt my love
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: How to create a blocking input requester

Post by RASHAD »

A little bit more

Code: Select all

Procedure Options(gh)
  OpenWindow(1,0,0,200,200,"Modal Window",#PB_Window_WindowCentered,WindowID(0))
  UseGadgetList(WindowID(1))
  TextGadget(1,10,10,120,gh,"Pick your Mode :")
  SpinGadget(2,135,10,45,gh,1,10,#PB_Spin_Numeric)
  SetGadgetState(2,4)
  TextGadget(3,10,40,120,gh,"Are you sure ?")
  OptionGadget(4,135,40,50,gh,"YES")
  OptionGadget(5,135,65,50,gh,"NO")
  SetGadgetState(4,1) 
  ButtonGadget(100,10,170,60,gh,"OK") 
  DisableWindow(0,#True) 
EndProcedure

LoadFont(0,"Tahoma",12)
SetGadgetFont(#PB_Default,FontID(0))

OpenWindow(0,0,0,300,300,"Main Window",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
dummy = TextGadget(#PB_Any,-80,0,80,30,"Test")
gh = GadgetHeight(dummy,#PB_Gadget_RequiredSize)+4
FreeGadget(dummy)
ButtonGadget(0,10,10,70,gh,"Options") 
Repeat 
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Quit = 1      
      
    Case #PB_Event_Gadget 
      Select EventGadget() 
        Case 0 
          Options(gh)
          
        Case 100 
          CloseWindow(1) 
          DisableWindow(0,#False) 
          SetActiveWindow(0)
          
      EndSelect
    Case #PB_Event_CloseWindow
      Select EventWindow() 
        Case 0
          Break
      EndSelect
  EndSelect 
Until Quit = 1

Egypt my love
davidow
New User
New User
Posts: 5
Joined: Mon Mar 20, 2023 7:34 am
Location: Uttoxeter, UK

Re: How to create a blocking input requester

Post by davidow »

Thank you all for your help and examples. These were just what I was looking for.
Post Reply