User only able on one window

Just starting out? Need help? Post your questions and find answers here.
donSHAYA
User
User
Posts: 95
Joined: Wed Mar 25, 2009 9:57 am

User only able on one window

Post by donSHAYA »

Hi all. How is it possible to let a specified window always (until the programmer decide when) be open? Just like a OpenFileRequester. When you hit outside the OpenFileRequester window the action doesn't take place. How can I do that on my window? Is it only on windows or is this also possible on Mac + Linux? Thank you very much.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: User only able on one window

Post by Kaeru Gaman »

this is called modal.
the app does only accept input in the modal requester.

there are codes around the forums...
in short:
- open your modal Window
- Disable your main window
- perform your input
- enable your main window again
- close your modal window

this is app-modal. other apps accept input, but the one app only accepts input in the modal window.

... there is also system-modal, no input at all except in the modal window is accepted.
it's a bit more complicated, but there maybe code around for this, too.
oh... and have a nice day.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: User only able on one window

Post by ts-soft »

Example:

Code: Select all

 Procedure OpenDialog()
  OpenWindow(1, 0, 0, 320, 240, "Dialog", #PB_Window_SystemMenu|#PB_Window_WindowCentered, WindowID(0)); <-important ParentID
  DisableWindow(0, #True); <- disable main after creation of modal window!
  ButtonGadget(1, 100, 180, 100, 30, "close")
EndProcedure

OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "main", #PB_Window_SystemMenu)
ButtonGadget(0, 270, 420, 100, 30, "Open Dialog")
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Select EventWindow()
        Case 0
          Break
        Default
          DisableWindow(0, #False); <- enable main window before destroy dialogwindow
          CloseWindow(EventWindow())
      EndSelect
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 0
          OpenDialog()
        Case 1
          DisableWindow(0, #False); <- enable main window before destroy dialogwindow
          CloseWindow(1)
      EndSelect
  EndSelect
ForEver 
donSHAYA
User
User
Posts: 95
Joined: Wed Mar 25, 2009 9:57 am

Re: User only able on one window

Post by donSHAYA »

Oh ok I see. But I wanted the System Modal. I searched for the System Modal in MSDN. I found SetSysModalwindow, but this is not a function (API), but there is a way to use it, but I dont know how.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: User only able on one window

Post by ts-soft »

SetSysModalwindow is a api for win3.11 :wink:
This api does nothing on your system and is useless
donSHAYA
User
User
Posts: 95
Joined: Wed Mar 25, 2009 9:57 am

Re: User only able on one window

Post by donSHAYA »

Oh ok. But so how can you make your Window a System-modal? Can't find nothing on MSDN or forum (that works)?
Post Reply