Jump to content

Recommended Posts

Posted

It took some digging, but I found a simple solution to a problem I've encountered many times:

how to have an active label or button on top of another active field

The solution was in a post from 10 years ago ... (yea, forums!)

The solution was:

CyberSlug, on Dec 21 2004, 01:58 PM, said:

Z-order is related to creation but in the reverse order that you think.
... create the main gif last and with the WS_CLIPSIBILINGS style.

 

Here's an example with a Close button on top of a gray square that is used to drag the window:

;
;   Simplified example of label on label
;
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

$GUI = GuiCreate("Test GUI" , 200 , 200, -1, -1, $WS_POPUP)

$close = GUICtrlCreateLabel("  Close  ", 120, 30 , 40, 14)
GUICtrlSetColor(-1 , 0xCC0000)
GUICtrlSetTip(-1, "Click to close")

GUICtrlCreateLabel("" , 60, 20 , 120, 120, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1 , 0xBBBBBB)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $close
            Exit
    EndSwitch
WEnd

This also works for buttons on Pic fields, which is what the original post covered.

post-29172-0-92840300-1414213643.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...