Jump to content

Fast topic. Clickable picture in GUI


Recommended Posts

Use Switch.. Case.. Endswitch

 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\Andrea\Pictures\Uplay\For Honor - Open Beta\For Honor - Open Beta2017-2-10-18-48-25.jpg", 224, 112, 100, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic1
            Exit
    EndSwitch
WEnd

Here is "Case $Pic1" which means "when you click that control (in out case $Pic1)

Hope you understand :)

Link to post
Share on other sites

Hello

Warning ! Do this test WITHOUT the image file.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\Andrea\Pictures\Uplay\For Honor - Open Beta\For Honor - Open Beta2017-2-10-18-48-25.jpg", 224, 112, 100, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic1
            Sleep (5000)
            beep()
    EndSwitch
WEnd

Do you understand why?
cordially

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...