Sign in to follow this  
Followers 0
ken82m

Disable/Enable GUI Window

6 posts in this topic

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


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

ken82m

Post the example code.

Edited by rasim

Share this post


Link to post
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

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
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:

Share this post


Link to post
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:


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
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)

Share this post


Link to post
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
Sign in to follow this  
Followers 0