Jump to content

[SOLVED] Reverse state of button


Recommended Posts

Hi,

 

I remember a script where i had seen an user inverse state of a button ( $GUI_ENABLE (64)   /  $GUI_DISABLE (128) ) in one line only

I remember it use Bit operation but i cannot reproduce it, can someone help ?

 

In fact if the button is enable i want to disable it and if he is disable , want to enable it, something like that :

 

GuiCtrlSetState ( $button , BitOr ( GuiCtrlGetSate ( $button ) )        ; i know this is NOT working, for explanation only

 

 

Thanks !

Edited by pinkfoyd
Link to comment
Share on other sites

Another one:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $Button_1, $Button_2, $Button_3, $Button_4, $msg, $state2, $state3, $state4
    GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered

    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("Button1 - Click me", 10, 30, 150)
    $Button_2 = GUICtrlCreateButton("Button2", -1, 0)
    $Button_3 = GUICtrlCreateButton("Button3", -1, 0)
    $Button_4 = GUICtrlCreateCheckbox("Button4", -1, 0)

    GUISetState() ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                $state2 = BitXOR(GuiCtrlGetState($Button_2), BitOR($GUI_DISABLE, $GUI_ENABLE))
                $state3 = BitXOR(GuiCtrlGetState($Button_3), BitOR($GUI_SHOW, $GUI_HIDE))
                $state4 = BitXOR(GuiCtrlRead($Button_4), BitOR($GUI_CHECKED, $GUI_UNCHECKED))
                GUICtrlSetState($Button_2, $state2)
                GUICtrlSetState($Button_3, $state3)
                GUICtrlSetState($Button_4, $state4)
        EndSelect
    WEnd
EndFunc   ;==>Example

 

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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

×
×
  • Create New...