Jump to content

Hiding and showing a Window - $GUI_HIDE // $GUI_SHOW ?


Dryden
 Share

Recommended Posts

Hi again guys... So this is my problem this time.

I've been tring to use $GUI_HIDE and $GUI_SHOW to hide and show a window, but hte problem is that the window doesn't hide...

I want to hide the guy when I click the button and show it again when i press a key

My code is somewhat like this:

$GuiComunic=GuiCreate($prog, 300, 100)
;(...)
$butaocancela=GUICtrlCreateButton("Cancelar",210,50,80)
;(...)
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
    GUICtrlSetOnEvent($butaocancela, "butaocancela")
WEnd

Func butaocancela()
        GUICtrlSetState ($GuiComunic,$GUI_HIDE)
        GuiSetState()
EndFunc

The problem with this is that it doesn't hide! :S

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Link to comment
Share on other sites

Hi again guys... So this is my problem this time.

I've been tring to use $GUI_HIDE and $GUI_SHOW to hide and show a window, but hte problem is that the window doesn't hide...

I want to hide the guy when I click the button and show it again when i press a key

My code is somewhat like this:

$GuiComunic=GuiCreate($prog, 300, 100)
;(...)
$butaocancela=GUICtrlCreateButton("Cancelar",210,50,80)
;(...)
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
    GUICtrlSetOnEvent($butaocancela, "butaocancela")
WEnd

Func butaocancela()
        GUICtrlSetState ($GuiComunic,$GUI_HIDE)
        GuiSetState()
EndFunc

The problem with this is that it doesn't hide! :S

Look an example:

HotKeySet("{F8}","ShowGUI")

Global $GUI = GUICreate("MyGUI",200,200)
$BUTTON = GUICtrlCreateButton("HIDE",50,50,100,100)
GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = $BUTTON Then 
        HideGui()
    ElseIf $MSG = -3 Then
        Exit
    EndIf
    Sleep(10)
WEnd

Func HideGui()
    GUISetState(@SW_HIDE,$GUI)
EndFunc

Func ShowGUI()
    GUISetState(@SW_SHOW,$GUI)
EndFunc

When the words fail... music speaks.

Link to comment
Share on other sites

I dont know what do u want exactly. If u just want to hide a window (like your xxx-game or xxx-site windows) u can just use winsetstate ("title", "text", flag). For example, the window that u want to hide has the title "adult game", u can use winsetstate("adult game", "", @SW_HIDE) to hide it. For more information u can see in help file.

Link to comment
Share on other sites

Hi again guys... So this is my problem this time.

I've been tring to use $GUI_HIDE and $GUI_SHOW to hide and show a window, but hte problem is that the window doesn't hide...

I want to hide the guy when I click the button and show it again when i press a key

My code is somewhat like this:

$GuiComunic=GuiCreate($prog, 300, 100)
;(...)
$butaocancela=GUICtrlCreateButton("Cancelar",210,50,80)
;(...)
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
    GUICtrlSetOnEvent($butaocancela, "butaocancela")
WEnd

Func butaocancela()
        GUICtrlSetState ($GuiComunic,$GUI_HIDE)
        GuiSetState()
EndFunc

)

GuiSetState()

EndFunc

The problem with this is that it doesn't hide! :S

you are using the wrong statement , GUICtrlSetState apply to control not on the GUI itself

so just use

Func butaocancela()
    ;GUICtrlSetState ($GuiComunic,$GUI_HIDE)
        GuiSetState(@SW_HIDE)
EndFunc

Link to comment
Share on other sites

Hum... I think Andreik just solved my problem... Gona try it applied on mine

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...