Jump to content
Sign in to follow this  
oldtimer

Button on top of label question

Recommended Posts

oldtimer

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.

Share this post


Link to post
Share on other sites
AdmiralAlkex

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

Share this post


Link to post
Share on other sites
oldtimer

That was it! I guess I should have figured that out for myself but couldn't.

Thank you very much.

Share this post


Link to post
Share on other sites
Valuater

For Buttons, you might want to take a look at ButtonHover()

Then, color the background with Skins....

Enjoy!!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.