Jump to content

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

Link to comment
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)
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.

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...