Jump to content

check If clicked on Picture control


Imperial
 Share

Recommended Posts

How to check If we pressed with Left mouse button on the Picture Control that was Created using the GUICtrlCreatePic Function

$Form = GUICreate("Form", 615, 437, 184, 123, BitOR($WS_MINIMIZEBOX,$WS_POPUP,$WS_GROUP))
$Pic1 = GUICtrlCreatePic("C:\pb_rUu4L_400x400.jpg", 144, 56, 337, 209)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        
    EndSwitch
WEnd

 

Edited by Imperial
Link to comment
Share on other sites

Use the $SS_NOTIFY option, and assign to a variable you can check.

$Pic1 = GUICtrlCreatePic("C:\pb_rUu4L_400x400.jpg", 144, 56, 337, 209, $SS_NOTIFY)

Then in your While 1 ... Wend loop, have something like the following.

Case $msg = $Pic1
    $clicked = 1

Obviously you adapt that to suit your needs and more than one Picture Control. Maybe even have a reset to clear the $clicked value.

The $clicked value could even be the file name of the image i.e. $clicked = "C:\pb_rUu4L_400x400.jpg"


 

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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

×
×
  • Create New...