Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ Hotspot troubles

Hotspot troubles

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Wyd   (14 posts)  Bio
Date Sun 24 May 2009 09:05 PM (UTC)
Message
Hi,

I'm trying my hand at making miniwindows, but I'm having trouble implementing hotspots.

The following code is in a plugin (and passes when used inside check())

WindowAddHotspot("shipNav", "North",
171, 10, 213, 53,
"", -- mouseover
"", -- cancelmouseover
"", -- mousedown
"", -- cancelmousedown
"mouseup", -- mouseup
"Hrm", -- hint text if they hover over it
0, 0))

however it doesn't actually seem to do anything.

If I use WindowHotspotInfo("shipNav", "North", <number>) then it returns the correct infomation about the hotspot, however WindowHotspotList("ShipNav") returns nil.


Is there anything extra I need to do to attach the hotspot to the window and enable it?

Thanks
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 24 May 2009 10:57 PM (UTC)
Message
Miniwindow names are case-sensitive so I would expect WindowHotspotList("ShipNav") to return nil.

What aspect isn't working? Is the hover text not appearing? Can you show more of the plugin please?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Wyd   (14 posts)  Bio
Date Reply #2 on Mon 25 May 2009 02:21 AM (UTC)

Amended on Mon 25 May 2009 03:54 AM (UTC) by Wyd

Message

if not nav then
  nav = {}
end

function mouseup(t, id)
	if id == "North" then
		Send("say turn north")
	end
end

--Create our nav window
if not nav.win then

	--Create our window
	WindowCreate("shipNav", 0, 0, 260, 300, 8, 1, ColourNameToRGB("black"))

	--Load our images
	WindowLoadImage ("shipNav", "moveCompassBackground", "C:/Program Files/MUSHclient/worlds/plugins/ShipNav/moveCompassBack.bmp")
	WindowLoadImage ("shipNav", "windBackground", "C:/Program Files/MUSHclient/worlds/plugins/ShipNav/windInfoBackground.bmp")


	--Draw stuff
	WindowDrawImage("shipNav", "moveCompassBackground", 128, 10,  255, 137, 2)
	check(WindowAddHotspot("shipNav", "North",
                   171, 10, 213, 53,
                   "", -- mouseover
                   "", -- cancelmouseover
                   "", -- mousedown
                   "", -- cancelmousedown
                   "mouseup", -- mouseup
                   "Hrm",    -- hint text if they hover over it
                   0, 0))


	--Small rectangle to show where the hotspot is while we get it working
	WindowRectOp ("shipNav", 1, 171, 10, 213, 53, ColourNameToRGB("orange"))
	WindowRectOp ("shipNav", 2, 0, 10,  122, 33, ColourNameToRGB("white"))
	WindowRectOp ("shipNav", 2, 0, 36,  122, 59, ColourNameToRGB("white"))
	WindowRectOp ("shipNav", 2, 0, 62,  122, 85, ColourNameToRGB("white"))
	WindowRectOp ("shipNav", 2, 0, 88,  122, 111, ColourNameToRGB("white"))
	WindowRectOp ("shipNav", 2, 0, 114,  122, 137, ColourNameToRGB("white"))
	WindowDrawImage("shipNav", "windBackground", 100, 145,  255, 295, 2)
	WindowRectOp ("shipNav", 2, 0, 145,  95, 190, ColourNameToRGB("purple"))
	WindowRectOp ("shipNav", 2, 0, 200,  95, 245, ColourNameToRGB("purple"))

	WindowRectOp ("shipNav", 2, 0, 255,  95, 295, ColourNameToRGB("purple"))

	WindowShow("shipNav", true)

	nav.win = true
end


The rest of the plugin has to do with the another miniwindow ("shipMap"), based of the mapping example Larkin posted elsewhere in the forum. The WindowRectOp() calls are just placeholders for parts I haven't implemented yet.

As for whats not working - tooltip isn't showing up, and the mouseup callback isn't been called. I tried to make a mouseover function, to test if it was picking up the moust moving into the area, but not getting anything from that, either



Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 25 May 2009 04:07 AM (UTC)
Message
Hmm, we had this problem not so long ago. ;)

Here is your problem line:


--Create our window
	WindowCreate("shipNav", 0, 0, 260, 300, 8, 1, ColourNameToRGB("black"))


The problem is that the flags (1) are set to:


1 - Draw underneath. If set, the miniwindow is drawn beneath the scrolling text in the output window.


Thus the miniwindow is "underneath" the text and the test for hotspots is not done. This is because if you are underneath the text, you can click on the text to select it, not the hotspot.

Change the 1 to a 0 and it works.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 25 May 2009 04:08 AM (UTC)
Message
I'll amend the help to make this a bit clearer.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Wyd   (14 posts)  Bio
Date Reply #5 on Mon 25 May 2009 04:13 AM (UTC)
Message
Ah ha, thanks!

Thought it might be something small like that.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,558 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.