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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Miniwindows
. . -> [Subject]  MW Hotspot tooltip... function with x/y location?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

MW Hotspot tooltip... function with x/y location?

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


Posted by Kovarid   (15 posts)  [Biography] bio
Date Fri 09 Jan 2015 07:25 PM (UTC)
Message
I don't /think/ it's currently possible,
but I'll ask here just to be sure.

I'm looking for a way to change the tooltip of a mw depending on the location of the mouse as it hovers.

Why?
I am using a heavily modified version of this:
http://www.gammon.com.au/forum/?id=10728

For a few games, and I'd like to be able to get rid of timestamps as regular text, and instead be able to hover over
text in the MW and have it pull the line timestamp from there.

This would most likely require the ability to call a function with the hotspot tooltip, and the function would need be given the current mouse x/y coordinates as well.

Thoughts?
[Go to top] top

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 09 Jan 2015 08:09 PM (UTC)
Message
GetInfo (283) and 284 return the current mouse location.

You should be able to use WindowHotspotTooltip to change the tooltip, for example, when the mouse moves.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 09 Jan 2015 08:10 PM (UTC)
Message
What seems the simplest to me is to just make each line of text in the window have its own hotspot, and make the mouseover text be the date/timestamp.

- Nick Gammon

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

Posted by Kovarid   (15 posts)  [Biography] bio
Date Reply #3 on Sat 10 Jan 2015 12:50 PM (UTC)
Message
Hmm.. I'll play with it see if I can do that.

I'm not certain how to accomplish it because of how the lines can be split up to fit into the window, but sounds like a fun experiment!
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Sun 11 Jan 2015 03:33 AM (UTC)

Amended on Sun 11 Jan 2015 03:35 AM (UTC) by Fiendish

Message
So off the top of my head...

Observe where it says "-- inject timestamp if wanted".

Instead of inserting a styled timestamp string into the styles table, skip down to the next part where it says "-- store the raw lines for use during resizing".

Replace " table.insert(rawlines, styles)" with something like " table.insert(rawlines, {styles, os.date (date_format)}), which then requires you to remember that now rawlines contains a list of pairs of two things, one of which is a raw line, instead of just a list of raw lines. Likewise change " fillBuffer(styles)" to " fillBuffer({styles, os.date(date_format)})"

Note that this now means that "for _,styles in ipairs(rawlines)" in init will be passing a table of both styles and a timestamp to fillBuffer.

Then at the top of fillBuffer, add "local timestamp = rawstyles[2]; local rawstyles = rawstyles[1]" to split them apart and get everything back to functioning.

Then inside fillBuffer change " add_line( line_styles, beginning )" to " add_line( line_styles, beginning, timestamp )".

Then go change the add_line function to take a third argument "timestamp".

Then in add_line, change " table.insert (lines, {line, false} )" to " table.insert (lines, {line, is_beginning_of_message, timestamp} )".

Note here how silly I was when adding the next line, doing an assignment after insertion instead of just inserting the right thing in the first place. Oops. No matter; it doesn't hurt anything.

Finally...

Notice how we find the right line in GetBufferedMessage. (" windowline = math.floor(((ypos-theme.TITLE_HEIGHT)/line_height)+1)-1"; if (#lines > windowline) then local line = windowline+lineStart)").

Thus, lines[windowline+lineStart][3] should give the timestamp you want with WindowInfo(Win,15) as ypos.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Kovarid   (15 posts)  [Biography] bio
Date Reply #5 on Thu 15 Jan 2015 04:06 AM (UTC)
Message
Ah, I went ahead and implemented a different way before
seeing your reply Fiendish.

Figured I'd go ahead and share the whole plugin, since I've added some enhancements that may be useful to others.
Some of this is only useful to the MUSH it was meant but, but eh.

* Supports slave windows (unlimited number of them) -- each trigger must be setup in the code though.

* Last 500 lines in each window is saved across sessions

* You can now rename the windows

* Spam filtering for subspace messages: If you get an updated 'status' message, it replaces the old line instead of adding additional spam to your window.

* Toggle-able tooltip timestamps (timestamps show as tooltips when you hover, instead of always visible). You can switch it on the fly.

* You can now search the window for matching text (using lua regex-style matches), it will hilite matching lines and display them.

http://pastebin.com/Xcz4AJTg

Feel free to give me feedback on my crappy code!
[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.


4,292 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 FutureQuest]