Jump to content
Sign in to follow this  

Clicking on controls on top of a guictrlcreatepic

Recommended Posts


Dear People,

I have used a large jpg to cover most of a GUI.

Then put a number of labels on top.

the GUiGetMsg doesnt acknowledge the labels.

if I remove the GUICtrlCreatePic, the labels are detected.

I have tried buttons; still no success.

How can I put controls on top of a GUICtrlCreatePic and have these controls picked up by GUiGetMsg?

Many thanks

Share this post

Link to post
Share on other sites

You must disable pic control, like in this code:

$hMain = GUICreate("Example")
$hPic = GUICtrlCreatePic(@WindowsDir & "Coffee Bean.bmp",0,0,400,400)
$Label = GUICtrlCreateLabel("This is a label",100,300,200,25,0x01)
GUICtrlSetBkColor($Label,-2)    ; Transparent background
$Button = GUICtrlCreateButton("Click Me",100,200,200,50)
GUICtrlSetState($hPic,128)  ; Disable Pic control

While True
    Switch GUIGetMsg()
        Case $Button
            GUICtrlSetData($Label,"Button was clicked")
        Case -3
Edited by Andreik

When the words fail... music speaks

Share this post

Link to post
Share on other sites

Thanks Bishop!

Works a treat.

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