Page 1 of 1

User only able on one window

Posted: Fri Apr 16, 2010 2:29 pm
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.

Re: User only able on one window

Posted: Fri Apr 16, 2010 2:38 pm
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.

Re: User only able on one window

Posted: Fri Apr 16, 2010 2:48 pm
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 

Re: User only able on one window

Posted: Sun Apr 18, 2010 3:55 am
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.

Re: User only able on one window

Posted: Sun Apr 18, 2010 1:30 pm
by ts-soft
SetSysModalwindow is a api for win3.11 :wink:
This api does nothing on your system and is useless

Re: User only able on one window

Posted: Tue Apr 20, 2010 12:29 am
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)?