Sign in to follow this  
Followers 0
NoHAX

How to make button invisible, but allowed to click?

8 posts in this topic

#1 ·  Posted (edited)

Yep, i dont want to cover button by some image.jpg file to make him like invisible

i want "cameleon" button :x

Edited by NoHAX

Share this post


Link to post
Share on other sites



Just use a label... :x

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Ehm but this must be clickable, i dont think there is event "onclick" for labels :x

Share this post


Link to post
Share on other sites

Just try it, it will work

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Cut-up from help file..

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $parent1, $ok1, $cancel1

    Opt("GUICoordMode", 2)
    Opt("GUIResizeMode", 1)
    Opt("GUIOnEventMode", 1)

    $parent1 = GUICreate("Parent1")
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")


    $ok1 = GUICtrlCreateButton("OK", 10, 30, 50)
    GUICtrlSetOnEvent(-1, "OKPressed")

    $cancel1 = GUICtrlCreateLabel("  Cancel", 0, -1)
    GUICtrlSetOnEvent(-1, "CancelPressed")

    GUISetState(@SW_SHOW)


    ; Just idle around
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>Example

Func OKPressed()
    MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle)
EndFunc   ;==>OKPressed


Func CancelPressed()
    MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle)
EndFunc   ;==>CancelPressed


Func SpecialEvents()


    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            Exit

        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSelect

EndFunc   ;==>SpecialEvents

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thx its working :x

I tried with GUIgetMsg, but Event option is working, Thx a lot :P

Share this post


Link to post
Share on other sites

GUIgetMsg() will work too!

You said "on event" so that was the example I gave you.

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Yep... works with message

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

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

    $Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100)
    $Button_2 = GUICtrlCreateLabel("Button Test", 20, 60)

    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
                Run('Notepad.exe')    ; Will Run/Open Notepad
            Case $msg = $Button_2
                MsgBox(0, 'Testing', 'Button 2 was pressed')    ; Will demonstrate Button 2 being pressed
        EndSelect
    WEnd
EndFunc   ;==>Example

8)


NEWHeader1.png

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