[Implemented] DisableWindow(Window.l,State.b)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

[Implemented] DisableWindow(Window.l,State.b)

Post by Flype »

Hello,
DisableGadget() is usefull, i think DisableWindow() would be nice to.
I think there's the equivalent function on linux and mac os, isn't it ?

Code: Select all

;-
;- Enable/Disable a window, just like the DisableGadget() function does...
;-

Procedure.l DisableWindow(Window.l,State.b)
  
  If IsWindow(Window)
    EnableWindow_(WindowID(Window),#True-State)
  EndIf
  
EndProcedure

Enumeration
  #WndParent
  #WndChild
EndEnumeration

If OpenWindow(#WndParent,0,0,680,480,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"Parent Window")
  
  If OpenWindow(#WndChild,0,0,400,300,#PB_Window_WindowCentered|#PB_Window_SystemMenu,"Child Window",WindowID(#WndParent))
    DisableWindow(#WndParent,#True)
    Repeat
      If WaitWindowEvent() = #PB_Event_CloseWindow
        CloseWindow(#WndChild) : Break
      EndIf
    ForEver
    DisableWindow(#WndParent,#False)
  EndIf
  
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
  
EndIf
And maybe, the parent window could be automatically disabled when we set the ParentWindowID of OpenWindow(), and automatically re-enabled when closing the child window. Just a suggestion... :roll:

Best regards.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

We have not found a function for this on MacOSX so far.
Maybe it can be emulated with other commands though.
quidquid Latine dictum sit altum videtur
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

humm, astonishing :? !
and what's happened on mac os when opening a MessageRequester() ?
the parent window should be locked, i suppose, so...
well, that's not a big problem.

[EDIT]
@freak: is your tool < IETool > available for Firefox ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Post Reply