Hotspots for desktop

I have created a hotspot pure Xojo method for WE posted in https://forum.xojo.com/10256-how-can-i-create-hotspots

Now, I have adapted the same method for Desktop, using the very same technique of displaying an image while another of the same dimension with colored shapes is used to locate the hot spots.

This allows the creation of UI with buttons of any shape, for instance.

hot-desk project

[quote=82694:@Michel Bujardet]I have created a hotspot pure Xojo method for WE posted in https://forum.xojo.com/10256-how-can-i-create-hotspots

Now, I have adapted the same method for Desktop, using the very same technique of displaying an image while another of the same dimension with colored shapes is used to locate the hot spots.

This allows the creation of UI with buttons of any shape, for instance.

hot-desk project[/quote]
Thank you Michel! Very generous for sharing all this!

:slight_smile:

Thats really cool that you have taken my original post related to web and turned it into a desktop method. I am going to try this out a little later and can already think where I might use it. Thanks for sharing.

And this one is truly cross platform. It works for Mac, Windows and Linux :slight_smile:

In this day and age of UI innovation, the square hotspots permitted by transparent canvas seem a bit limited :wink:

Maybe Xojo Inc will take up your case for cross platform as well as web vector type hotspots so that we can build them within the IDE or at least pass the data so that they can be built in some other IDE (a program written in Xojo perhaps) that will output Xojo compatible data to plug in to the bit that Xojo Inc might offer in a future release (hopefully not too long away) :wink:

I am pretty confident Xojo will consider the feature request to be able to use HTML image maps within WE programs. It is after all a very basic feature. I have used them for 15 years.

In Desktop applications, what is basically missing is the transparent polygon, which would allow easy construction of hotspots.

It would be really great if someone created a vector plugin which would then allow you to do hotspots and other fancy stuff that you can do with vectors.

You should be able to create a canvas subclass that will take vectors in the form of object2d’s. It would assign a color to each object2d and draw them into a picture, then use Michal’s code from there. It should fire a Hit event with the ID of the object. So I guess you would want to pass in an ID and an object for each hotspot.