Frustrated with HotSpots

Posted by Katie Love on Sat 21 Mar 2009 06:17 PM — 3 posts, 13,566 views.

#0
I must be doing something wrong. I'm trying to just get at least one hotspot working using my own code. I've downloaded one if Nick's scripts off the form and it works perfectly, so I know it's obviously something I'm doing wrong. I'm guessing I don't quite understand how they work.

What I'm trying to do is a simple window, blue background with a hotspot in it that has a mouseover event with an icon change to a hand. If I can put my mouse in the area and see the hotspot is working, then I will at least know how they work and can apply it to something more complex.

The problems is, I can't seem to get it to work. Below is the code. If someone could point out what I'm missing I would be very grateful!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
<!ENTITY test1 "testing 1 2 3" >
<!ENTITY test2 "testing 4 5 6" >
]>


<muclient>
<plugin
name="hotspot_plugin"
author="KL"
language="Lua"
purpose = "Hotspots plugin"
save_state = "y"
date_written = "2009-03-20"
date_modified = "2009-03-20"
requires="3.23"
version="1.00"

id = "f8a72c7f063b33b1ec58c178"
>
<description trim="y">
<![CDATA[
Put your description of what the plugin does here, and how to use it.

sample:help - shows this description in the output window
]]>
</description>
</plugin>

<script>
<![CDATA[

function mouseover (flags, hotspot_id)
Note("moused over!")
end

function OnPluginInstall ()
Note("plugin installed!")
win = GetPluginID()

WindowCreate(win, 0, 0, 150, 150, 6, 1, ColourNameToRGB("blue"))


Note(WindowAddHotspot(win, "hotspot",
2, 2, 50, 50,
"mouseover",
"",
"",
"",
"",
"Test Window",
1, 0))

WindowShow(win, true)

end -- function
]]>
</script>
</muclient>
Australia Forum Administrator #1
Your problem is that you created the miniwindow under the main window. It works if you change the create line to:


WindowCreate(win, 0, 0, 150, 150, 6, 0, ColourNameToRGB("blue"))


Hotspots are not detected in a window under the main window, as the "text plane" (which itself can generate mouse-over or mouse-down events, like clicking on text) has the higher priority.
#2
Nick...

You are the best! Thank you!