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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

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

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

hotspots' function for buttons

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Tkl1129   Hong Kong  (43 posts)  [Biography] bio
Date Tue 12 Jul 2011 02:22 AM (UTC)  quote  ]
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  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 12 Jul 2011 03:25 AM (UTC)  quote  ]
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)  quote  ]
Message

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

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 12 Jul 2011 04:47 AM (UTC)  quote  ]
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.


971 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]