Jump to content

Image click?


pizza
 Share

Recommended Posts

Hmm, well you should take a look at my script GTCard here. What you want to examine is how to load a jpg imagine using;

;Assumes image.jpg is 200 x 200 pixels.
$my_click_image = GUICtrlCreatePic("image.jpg", 0, 0, 200, 200)

Then in your GUI loop you need to use either case or if statement;

GuiSetState()
$msg = GUIGetMsg()
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $my_click_image
            ;Do something neat
        Case $msg = $another_image
            ;Do something else
        EndSelect       
    ;This is the if version you won't need both examples 
    If $msg = $my_click_image Then
        ;Do something neat
    EndIf
WEnd

The "cards" in my program are just clickable jpegs. You will need to download the images and other files to make the script work.

Hope that helps.

Link to comment
Share on other sites

You can try

Opt ( "GuiOnEventMode", 1 ) 

    $_GUI = GUICreate ( '', 400, 300 ) 
    $_Pic = GUICtrlCreatePic ( @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", 0, 0, 136, 142 )
    GUICtrlSetTip ( $_Pic, "Open Youtube.com !" ) 
    GUICtrlSetOnEvent ( $_Pic, '_ClickOnPic' )  
    GUISetState ( @SW_SHOW )


While 1
    Sleep ( 20 )
WEnd

Func _ClickOnPic ( )
   ShellExecute ( "http://www.youtube.com/" )
EndFunc ;==> _ClickOnPic ( )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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