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 ➜ Suggestions ➜ hotspot feature request

hotspot feature request

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


Posted by Bast   (78 posts)  Bio
Date Tue 15 Jun 2010 07:14 PM (UTC)
Message
Allow mouse scroll wheel events to be used in hotspots, so that you can use the scrollup/scrolldown to navigate a miniwindow.

Thanks,
Bast

Bast

Scripts: http://github.com/endavis
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 16 Jun 2010 03:56 AM (UTC)
Message
Added to version 4.52 (WindowScrollwheelHandler function).

- Nick Gammon

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

Posted by Bast   (78 posts)  Bio
Date Reply #2 on Wed 23 Jun 2010 05:04 AM (UTC)
Message
Hey Nick,

Just curious about this. I haven't looked at the MUSHclient source any, but I was looking at the commit for this to see if there was a way to tell if the mousescroll was up or down, but couldn't figure it out. Will we be able to tell?

Bast

Bast

Scripts: http://github.com/endavis
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 23 Jun 2010 05:20 AM (UTC)
Message
It's a bit subtle but it is in these lines:


if (Mouse_Wheel_MiniWindow (pDoc, point, zDelta < 0 ? -1 : 1))
   return 1;


Basically you will get -1 or 1 to indicate the direction it was scrolled. This will be in the documentation for WindowScrollwheelHandler.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #4 on Wed 23 Jun 2010 06:27 AM (UTC)

Amended on Wed 23 Jun 2010 06:28 AM (UTC) by Twisol

Message
Here's a test script I used on my custom build.

function OnScroll(...)
  tprint{...}
end

WindowCreate("foo", 0, 0, 50, 50, 12, 0, 0xFFFFFF)
WindowShow("foo")

WindowAddHotspot("foo", "foo-h1", 0, 0, 49, 49, "", "", "", "", "", "", 0, 0);

WindowScrollwheelHandler("foo", "foo-h1", "OnScroll")


When the scrollwheel is moved a notch upwards, OnScroll is called with a parameter list (1, "foo-h1"). When it's moved a notch downwards, it's called with a parameter list (-1, "foo-h1"). So your OnScroll callback would probably look like:

function OnScroll(direction, hotspod_id)
  -- ...
end




EDIT: Nick, just curious, but is there any reason we can hold Alt and scroll to call the callback, but not Shift or Ctrl?

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 23 Jun 2010 07:08 AM (UTC)
Message
Twisol said:

EDIT: Nick, just curious, but is there any reason we can hold Alt and scroll to call the callback, but not Shift or Ctrl?


Why would you hold them? To give your fingers more wear and tear?

Anyway, I think that Ctrl+wheel means something like "zoom in" and that is discarded in the wheel processing.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #6 on Wed 23 Jun 2010 07:17 AM (UTC)
Message
Well, you can ctrl-click and such. They're modifier keys, after all. It's not a big issue, but I can easily see using modifiers with the scrollwheel to change what exactly you're scrolling.

Hmm, well I guess there's no way to get the modifier keys from a scrollwheel callback anyways, is there? Oh well.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #7 on Wed 23 Jun 2010 09:38 PM (UTC)
Message
I've changed the way it works a bit. I can see the sense of wanting to alt-scroll. A little warning though, in some environments (eg, the Mac) control-scroll wheel zooms the whole window in, and the event doesn't reach the virtual machine.

Instead of the first argument to the callback being -1 or +1, now it is a bit mask like the drag callback.

The mask is:

0x01 - shift
0x02 - control
0x04 - alt
0x100 - scrolled down


So it bit 0x100 is on, the wheel was scrolled down, otherwise it was scrolled up.

Also added GetInfo (294) to let you check at any time the status of the various keys like caps lock, shift, control and so on.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #8 on Wed 23 Jun 2010 10:06 PM (UTC)
Message
Awesome! Thanks, Nick.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Bast   (78 posts)  Bio
Date Reply #9 on Tue 13 Jul 2010 03:45 AM (UTC)
Message
Hey Nick,

The lua example for the help at http://www.gammon.com.au/scripts/function.php?name=WindowScrollwheelHandler needs a ~= 0 on the bit.band test or you get down all the time.


function wheel_move (flags, hotspot_id)
  if bit.band (flags, 0x100) ~= 0 then

    -- wheel scrolled down (towards you)
  else

    -- wheel scrolled up (away from you)
  end -- if

  return 0  -- needed for some languages
end -- drag_move

Bast

Bast

Scripts: http://github.com/endavis
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #10 on Tue 13 Jul 2010 04:40 AM (UTC)

Amended on Tue 13 Jul 2010 04:41 AM (UTC) by Nick Gammon

Message
Good point. Fixed in the documentation for the next release (and in the on-site documentation you quoted, right now).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


33,786 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.