Jump to content

Button on top of label question


Recommended Posts

I have created a simple GUI form. On the form, I want a button setting on top of a label. (for appearance, with colored background). I find that if I create the label first, then the button, the button shows up but won't "press". If I create the button first, then the label, the label is hidden. I tried setting the TOPMOST style but couldn't make that work.

Is there a "simple" way to create the button on top of the label and still have it function properly?

Thanks in advance for any suggestions.

Link to comment
Share on other sites

Hi and Welcome to the forums!!

Try disabling the label so it don't get the clicks instead of the button :)

#include <GUIConstantsEx.au3>

GUICreate(@ScriptName, 320, 240)
GUICtrlCreateLabel("", 0, 0, 320, 240)
GUICtrlSetBkColor(-1, 0xFFC0CB)
GUICtrlSetState(-1, $GUI_DISABLE)
$hButton = GUICtrlCreateButton("Press me", 50, 50, 75, 25)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            MsgBox(0, "Button pressed!", "Button pressed!")
    EndSwitch
WEnd
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...