[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Miniwindows
. . -> [Subject]  hotspots' function for buttons

hotspots' function for buttons

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


Posted by Tkl1129   Hong Kong  (43 posts)  [Biography] bio
Date Tue 12 Jul 2011 02:22 AM (UTC)
Message
I'm do testing on button + hotspot, and I've got problem.
I use mouseover + cancelmouse over be the test tools.
if the mouseover function use "hotspot_id", it will apply to all hotspot, but what if I only want it apply to specific hotspot? am I able to make 2 function, 1 for "hs1" and 1 for "hs2", but seems it don't work, or make 2 different function name recall to that hotspot? I just want a simply way to write it, thanks.
----------------------------------------------------------
Case:
--Mouseover button 1, color "maroon" -> "red"
--Mouseover button 2, color "maroon" -> "blue"

--button 1
WindowRectOp (win, miniwin.rect_fill, 50, 50, 100, 100,
ColourNameToRGB("maroon")) -- filled
--button 2
WindowRectOp (win, miniwin.rect_fill, 50, 150, 100, 200,
ColourNameToRGB("maroon")) -- filled

--mouseover function
function mouseover (flags, hs1)
WindowRectOp (win, miniwin.rect_fill, 50, 50, 100, 100,
ColourNameToRGB("red")) -- filled
Redraw ()
end -- mouseover
function mouseover (flags, hs2)
WindowRectOp (win, miniwin.rect_fill, 50, 150, 100, 200,
ColourNameToRGB("blue")) -- filled
Redraw ()
end -- mouseover

--Cancelmouse function
function cancelmouseover (flags, hs1)
WindowRectOp (win, miniwin.rect_fill, 50, 50, 100, 100,
ColourNameToRGB("maroon")) -- filled
Redraw ()
end -- cancelmouseover
function cancelmouseover (flags, hs2)
WindowRectOp (win, miniwin.rect_fill, 50, 150, 100, 200,
ColourNameToRGB("maroon")) -- filled
Redraw ()
end -- cancelmouseover


--hotspot for button 1
WindowAddHotspot(win, "hs1",
50, 50, 100, 100, -- rectangle
"mouseover",
"cancelmouseover",
"mousedown",
"cancelmousedown",
"mouseup",
"Drag it!", -- tooltip text
miniwin.cursor_hand, 0) -- hand cursor

--hotspot for button 2
WindowAddHotspot(win, "hs2",
50, 150, 100, 200, -- rectangle
"mouseover",
"cancelmouseover",
"mousedown",
"cancelmousedown",
"mouseup",
"Drag it! 2", -- tooltip text
miniwin.cursor_hand, 0) -- hand cursor

--------------------------------------------------------
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 12 Jul 2011 03:25 AM (UTC)
Message
Template:codetag To make your code more readable please use [code] tags as described here.


Use different function names, eg.


WindowAddHotspot(win, "hs2",
50, 150, 100, 200, -- rectangle
"mouseover_hs2",
"cancelmouseover_hs2",
"mousedown_hs2",
"cancelmousedown_hs2",
"mouseup_hs2",
"Drag it! 2", -- tooltip text
miniwin.cursor_hand, 0) -- hand cursor



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Tkl1129   Hong Kong  (43 posts)  [Biography] bio
Date Reply #2 on Tue 12 Jul 2011 04:37 AM (UTC)
Message

-- I will remember this, thanks.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 12 Jul 2011 04:47 AM (UTC)
Message
Template:function=WindowHotspotInfo WindowHotspotInfo

The documentation for the WindowHotspotInfo script function is available online. It is also in the MUSHclient help file.



That could save you keying in the coordinates of each hotspot many times. Given the hotspot ID (eg "hs2") you can find out where it is, thus allowing you to fill in the correct rectangle.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


12,992 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]