Jump to content

Any way to define hotspots (like in html)


sshrum
 Share

Recommended Posts

I'm trying to write a app that will launch various apps / commands.

I'm going to create a gui that will display a picture file (think of it as a button template).

I'd like to be able to define hotspots (think HTML) on the graphic so I can have the user click on a specific region and then execute the command associated with it. Ultimately, I'd liketo have the hotspot regions defined in a INI or text file so I can change it when needed.

Oh...bear in mind that some of the buttons are not square/rectangular in shape all the time.

Possible?

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Link to comment
Share on other sites

#include <GuiConstants.au3>

GuiCreate("Hotspot", 200, 210)
GuiCtrlCreateLabel("Click Picture", 15, 10, 60,17)
GuiCtrlCreateLabel("Click the letter U or O", 15, 110, 110,17)

$hotspot = GuiCtrlCreateLabel("", 15, 25, 169,68) ;Dummy label placed behind $pic
GUICtrlSetCursor($hotspot, 0) ;Cursor for hotspot
$pic = GuiCtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\logo4.gif",15,25, 169,68)

$hotspot2 = GuiCtrlCreateLabel("", 100, 151, 20,25) ;Dummy label placed behind letter 'U' $pic2
GUICtrlSetCursor($hotspot2, 0)
$hotspot3 = GuiCtrlCreateLabel("", 132, 151, 20,25) ;Dummy label placed behind letter 'O' $pic2
GUICtrlSetCursor($hotspot3, 0)
$pic2 = GuiCtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\logo4.gif",15,125, 169,68)
GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
    Exit
        Case $msg = $hotspot
            MsgBox(64, "Hotspot", "You clicked the picture")
        Case $msg = $hotspot2
            MsgBox(64, "Hotspot", "You clicked on the letter U")
        Case $msg = $hotspot3
            MsgBox(64, "Hotspot", "You clicked on the letter O")                
    EndSelect
WEnd

Link to comment
Share on other sites

While that does work for squared/rectangulared hotspots, it doesn't allow for polygon/circular hotspots and short of creating a crud-load of labels to cover the area I need would be a little tedious.

Maybe this is something that might be considered for a future release?

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

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