Sign in to follow this  
Followers 0
Dazzler

Clicking on controls on top of a guictrlcreatepic

3 posts in this topic

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



#2 ·  Posted (edited)

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)
GUICtrlSetFont($Label,16,800,1)
GUICtrlSetBkColor($Label,-2)    ; Transparent background
$Button = GUICtrlCreateButton("Click Me",100,200,200,50)
GUICtrlSetFont($Button,16,800,1)
GUICtrlSetState($hPic,128)  ; Disable Pic control
GUISetState(@SW_SHOW)

While True
    Switch GUIGetMsg()
        Case $Button
            GUICtrlSetData($Label,"Button was clicked")
        Case -3
            Exit
    EndSwitch
    Sleep(10)
WEnd
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  
Followers 0