Jump to content

Button on top of Image


Recommended Posts

Ok, I am having a problem with a button that happens to rest on top of a background image.

You can tab to the button, and it works fine, just for some reason you cannot seem to be able to click it.

Is this a limitation? or is this me?

$pInformationWindow = GUICreate('Information Window', $WINDOWWIDTH, $WINDOWHEIGHT, $WINDOWLOCATIONX, _
        $WINDOWLOCATIONY, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_LAYERED))
    
    $pInformationBK = GUICtrlCreatePic($BKFILELOCATION, 0, 0, 0, 0)
    
    $pInformationLabel = GUICtrlCreateLabel("Computer Information:"& _
        @LF & $sComputerInformation, 20, 20, 220, 135, $SS_CENTER)
    GUICtrlSetFont($pInformationLabel, 9, 4, '', 'ARIAL BOLD')
    GUICtrlSetBkColor($pInformationLabel, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($pInformationLabel, $WINDOWFONTCOLOR)
    
    $buttonInfoWindowClose = GUICtrlCreateButton("X", 200, 9, 50, 12, BitOR($BS_FLAT, $BS_BITMAP), $WS_EX_TOPMOST)
    GUICtrlSetFont($buttonInfoWindowClose, 6, 2, '', 'ARIAL BOLD')
    ;GUICtrlSetTip($buttonInfoWindowClose, "Close")
    
    GUISetState(@SW_SHOW,$pInformationWindow)

For some reason it will not let me click the button while the picture is under it, if I move the picture then I can click it fine?

Link to comment
Share on other sites

Try disabling the picture by inserting GuiCtrlSetState(-1,$GUI_DISABLE) in the line after GUICtrlCreatePic.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

That did it, thank you very much!!!

from the doc

If a picture is set as a background picture, as the other controls will overlap, it important to disable the pic control : GuiCtrlSetState(-1,$GUI_DISABLE). This does not work with Tab control which behave differently. in this case you need to create the picture with the $WS_CLIPSIBLINGS style, some $GUI_ONTOP can still be necessary for the tab control.

It is allways usefull to search in the doc...
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...