Sign in to follow this  
Followers 0
ShawnW

2 short GUI questions

3 posts in this topic

Here is some test code.

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

$TEST = GUICreate("TEST", 250, 80)
$Required = GUICtrlCreateInput("", 25, 15, 200, 20)
$Optional = GUICtrlCreateInput("", 25, 40, 100, 20)
GUICtrlSetState($Optional, $GUI_DISABLE)
GUISetState(@SW_SHOW, $TEST)    ; Show GUI

While True
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Required
            If $Required <> "" Then
                GUICtrlSetState($Optional, $GUI_ENABLE)
            Else
                GUICtrlSetState($Optional, $GUI_DISABLE)
            EndIf
    EndSwitch
WEnd

1) Is there any way to check the state of the required box while it still has focus, as soon as the user types something, so that the optional box can be enabled without either hitting enter or clicking out of the required box?

2) Why doesn't the disable work after you type something then delete it again?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1) try ControlGetFocus if you need it, but i dont beleave that youl need it

2) After 160 posts i cant beleave that you dont know how to read data from gui ;)

While 1
    $nMsg = GUIGetMsg()
    If $nMsg = $GUI_EVENT_CLOSE Then Exit
    Select
        Case GUICtrlRead($Required) And GUICtrlGetState($Optional) = 144
            GUICtrlSetState($Optional, $GUI_ENABLE)
        Case Not GUICtrlRead($Required) And GUICtrlGetState($Optional) = 80
            GUICtrlSetState($Optional, $GUI_DISABLE)
    EndSelect
WEnd

Note that i used GUICtrlGetState on your request, if it whas me i stored it to some variable to track last change.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

That works with the And GUICtrlGetState() in there and changing to select.

I don't normally write scripts that require an interface, in fact most of my scripts are required to be invisible to the affected users. That said though I do know how to read gui data, and that part about disabling it when I delete it was actually working fine in my real GUI. I'm just tired and couldn't see the mistake when I was making the example so figured I'd ask. ;)

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