Jump to content

Disable/Enable GUI Window


ken82m
 Share

Recommended Posts

I'm trying to disable and re-enable a window temporarily while I pop something up on the screen.

Except when I re-enable it, the screen disappears.

I have to issue an @SW_HIDE and then an @SW_SHOW to get it back

which of course causes the window to flash on off really quickly.

Is this normal behavior or am I doing something wrong?

I did try the Lock/Unlock feature but I like the way the window behaves using this method.

Thanks,

Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

I have commented out the two lines that actually make this work so you can see the behavior.

Thanks,

Kenny

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Form1 = GUICreate("Form1", 633, 454, 192, 114)
Global $TestButton = GUICtrlCreateButton("TestButton", 448, 112, 129, 33, 0)
Global $Input = GUICtrlCreateInput("Input", 16, 64, 577, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $TestButton
            GUISetState(@SW_DISABLE, $Form1)
            GUICtrlSetData($Input, FileSelectFolder("Select Archive Folder", "", 1, "") & "\")
            If GUICtrlRead($Input) = "\" Then GUICtrlSetData($Input, "")
            GUISetState(@SW_ENABLE, $Form1)
        ;GUISetState(@SW_HIDE, $Form1)
        ;GUISetState(@SW_SHOW, $Form1)
    EndSwitch
WEnd

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

ken82m

Example:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Form1 = GUICreate("Form1", 633, 454, 192, 114)
Global $TestButton = GUICtrlCreateButton("TestButton", 448, 112, 129, 33, 0)
Global $Input = GUICtrlCreateInput("Input", 16, 64, 577, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $TestButton
            $sFolder = FileSelectFolder("Select Archive Folder", "", 1, "", $Form1)
            If ($sFolder <> "") And (FileExists($sFolder) = 1) Then GUICtrlSetData($Input, $sFolder & "\")
    EndSwitch
WEnd

:mellow:

Link to comment
Share on other sites

Thanks, I was just trying to find some way to prevent user from click on Form1 while the browse window was open.

No big deal but thanks :mellow:

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

This is what I would use

It does flicker but it is better than hiding and unhiding it.

GUISetState(@SW_DISABLE, $Form1)
$sFolder = FileSelectFolder("Select Archive Folder", "", 1, "", $Form1)
If ($sFolder <> "") And (FileExists($sFolder) = 1) Then GUICtrlSetData($Input, $sFolder & "\")
GUISetState(@SW_ENABLE, $Form1)
GUISetState(@SW_RESTORE, $Form1)
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...