LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   Control.MouseWheel() event not working for you? (https://www.lotrointerface.com/forums/showthread.php?t=1094)

Digital_Utopia 09-26-2010 08:22 PM

Control.MouseWheel() event not working for you?
 
If you've ever had a reason to try to track the mousewheel, and couldn't seem to get it to fire while using a Window or a Control, that's because neither of these elements are set up to use the mousewheel.

Instead, use something that does, like a ListBox control - size it/color it just like you would for a control, and it will do the job nicely. :)

Yes, that's right - the event ListBox inherits from the Control class, doesn't actually work for the Control class.

Equendil 06-13-2011 02:29 PM

Thanks for the tip!

Equendil 06-13-2011 02:58 PM

Meh, this is hopeless for me, I wanted to use an invisible listbox to catch mouse wheel events, but it won't catch them unless it's in front of everything else, unlike MouseEnter/MouseLeave events. Once in front of everything else, of course, nothing else is getting mouse events. Argh.

Digital_Utopia 06-16-2011 08:44 PM

Quote:

Originally Posted by Equendil (Post 6651)
Meh, this is hopeless for me, I wanted to use an invisible listbox to catch mouse wheel events, but it won't catch them unless it's in front of everything else, unlike MouseEnter/MouseLeave events. Once in front of everything else, of course, nothing else is getting mouse events. Argh.

Well, I'm not exactly sure what you're trying to do - but keep in mind that you can kinda fake mouse events - as Lua event functions can be called like any other function, and if all else fails - just compare the x,y coords of the mouse pointer to the relative location of the child control.

Equendil 06-17-2011 11:13 AM

Well, I was writing a listbox class more to my liking (never liked those list boxes that store their items, and as a consequence, handle the list structure/order which should be left to the client), mouse events would have to be redirected generically to control trees, and I can see myself rewriting the entire Turbine.UI.* API from that point. :p

As tempting as it might be, I'll just forget about MouseWheel events for the time being, I think :(

Edit: Or I might try to use a listbox as a master control for my listbox, that might actually work.

Equendil 06-18-2011 08:12 PM

Alright, I sorted my mouse wheel problem in the following way:

- Using a Turbine.UI.Button as a parent control.
- Stealing MouseWheel events from child controls, as in Turbine.UI.Control controls, they *do* get mouse wheel events with a Turbine.UI.Button as parent ...

Grabbing events from child controls is inelegant at best and it still doesn't solve the more general problem that child controls (with mouse visibility set to true) prevent their parent controls from receiving any mouse event other than Enter/Hover/Leave (so in my situation, a checkbox within a control within my listbox would prevent scrolling), but as a kludge, it does the trick.

Digital_Utopia 06-19-2011 12:18 AM

Quote:

Originally Posted by Equendil (Post 6669)
Alright, I sorted my mouse wheel problem in the following way:

- Using a Turbine.UI.Button as a parent control.
- Stealing MouseWheel events from child controls, as in Turbine.UI.Control controls, they *do* get mouse wheel events with a Turbine.UI.Button as parent ...

Grabbing events from child controls is inelegant at best and it still doesn't solve the more general problem that child controls (with mouse visibility set to true) prevent their parent controls from receiving any mouse event other than Enter/Hover/Leave (so in my situation, a checkbox within a control within my listbox would prevent scrolling), but as a kludge, it does the trick.

To be perfectly honest, how advanced a plugin is, is directly proportional to the number of kludges used within it :p

By the way, since I was just on the lotro forums and noticed it, nice job on Bootstrap! Definitely one of the best looking, most advanced in-game plugin managers I've seen :)

Equendil 06-20-2011 12:42 PM

Quote:

Originally Posted by Digital_Utopia (Post 6670)
To be perfectly honest, how advanced a plugin is, is directly proportional to the number of kludges used within it :p

Haha, yeah, there is some truth to that :)

Quote:

By the way, since I was just on the lotro forums and noticed it, nice job on Bootstrap! Definitely one of the best looking, most advanced in-game plugin managers I've seen :)
Thanks !


All times are GMT -5. The time now is 12:39 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI