PDA

View Full Version : MouseWheel Event


Fortunis
07-08-2011, 01:43 PM
Does anyone know how to check for MouseWheel up and down events (seperatly), or if its even possible?

MrJackdaw
07-08-2011, 03:21 PM
I know they work, but I'll be damned if I can remember how I used them!

Fortunis
07-08-2011, 03:39 PM
Thx for your response MrJackdaw :)

Spent ages trying to figure it out, without any luck. Ive moved onto dragging the window instead of mousewheel scrolling, but still looking for an answer to the mousewheel scrolling.

btw its not a window setup that can use an effecient scrollbar. It has one but can only operate it while having mouse pointer on the scrollbar :s

Turbine seriously need to improve functionality of the API. Theres many things ive come across that should work but they just dont make sense.

Take [SetStretchMode] for instance. An image needs [SetStretchMode] if its to be altered in size but in using [SetStretchMode], its FORCED to be visible outside its parent window boundary :mad:

D.H1cks
07-08-2011, 05:35 PM
As far as I know there is only one event, but you can tell which direction by the value given. One direction will give you a positive value, the other negative.

if(args.Direction == -1) then

That is what I do to check.

Digital_Utopia
07-08-2011, 06:15 PM
Also, make sure you're using a ListBox (http://www.lotrointerface.com/forums/showthread.php?t=1094). Mousewheel events will not fire on a Control or a Window.

D.H1cks
07-08-2011, 06:29 PM
I use labels and quickslots to capture some mouse wheel events......

Fortunis
07-08-2011, 07:02 PM
Thanks for that, guys. I'll check args.direction tomorrow and report back :)

I use labels as interior windows. A listbox isnt really the thing to use for what im doing :)... Im not scrolling just text, which is how the default scrollbars are setup usually. Im scrolling images, labels, checkboxes, other scrollbars, buttons... Why didnt i just say everything lol!

Alot of obstacles to get past due to the API problems, as im sure your aware ;)

Digital_Utopia
07-08-2011, 08:40 PM
I use labels and quickslots to capture some mouse wheel events......

Thanks for that, guys. I'll check args.direction tomorrow and report back :)

I use labels as interior windows. A listbox isnt really the thing to use for what im doing :)... Im not scrolling just text, which is how the default scrollbars are setup usually. Im scrolling images, labels, checkboxes, other scrollbars, buttons... Why didnt i just say everything lol!

Alot of obstacles to get past due to the API problems, as im sure your aware ;)

Ah ok, never even imagined that labels would work for that, but I guess if I did more that required text input I'd have seen that. But, yeah - just because something would make sense - doesn't mean that it applies to the API :p

MrJackdaw
07-09-2011, 01:32 AM
Don't know if this is any use, but this comes from when I was fooling around trying to understand the MouseWheel event;
NewQuickslot=class (Turbine.UI.Lotro.Quickslot)
function NewQuickslot:Constructor (size)
Turbine.UI.Lotro.Quickslot.Constructor(self)
self.size=size
self.ShortcutChanged=function()
if self.size~=36 then self:SetStretchMode(1) end
self:SetSize(self.size,self.size)
end
end

Window={}
Window=Turbine.UI.Window()
Window:SetVisible(true)
Window:SetSize(100,100)
Window:SetPosition(0,0)

Window.Quickslot=NewQuickslot(36)
Window.Quickslot:SetPosition(0,0)
Window.Quickslot:SetParent(Window)

Window.Quickslot.MouseWheel=function(sender, args)
Turbine.Debug.Table.Dump(args)
Turbine.Shell.WriteLine(args.Direction)
end

Fortunis
07-09-2011, 04:38 AM
Don't know if this is any use, but this comes from when I was fooling around trying to understand the MouseWheel event;


Window.MouseWheel=function(sender, args)
Turbine.Shell.WriteLine(args.Direction)
end

if(args.Direction == -1) thenAre you kidding? This is perfect!!! Thanks MrJackdaw and D.H1cks :D

Ive learnt something new. I wonder what else you/i could find with debug dump. I did try to WriteLine(args) but got empty line printed (before making this thread). So i guess in the future when i get an empty line, it signifies that there is debug info attached to it.

:)

Equendil
07-09-2011, 05:09 AM
Interestingly enough, I found out that a Turbine.UI.Control *will* fire MouseWheel events if it's a child of a control that does (or at least of Turbine.UI.Button, which I use as a container).

Fortunis
07-09-2011, 05:50 AM
Interestingly enough, I found out that a Turbine.UI.Control *will* fire MouseWheel events if it's a child of a control that does (or at least of Turbine.UI.Button, which I use as a container).


Well that event is already in the wiki here (http://www.lotrointerface.com/wiki/Control) :)

The main problem was finding out direction, which the other guys pointed out.

SanDBoX
07-09-2011, 11:07 AM
[code] I did try to WriteLine(args) but got empty line printed (before making this thread). So i guess in the future when i get an empty line, it signifies that there is debug info attached to it.

One thing I have found very handy is to use the type function.
WriteLine( type( args ) )

or you can build a function that will mine the key:data pairs out of a table. That way you just have to pass the args directly to it and you will find out all the information contained within. (really usefull when you cant figure out where the new data you inserted went)

Equendil
07-09-2011, 12:19 PM
Well that event is already in the wiki here (http://www.lotrointerface.com/wiki/Control) :)

The main problem was finding out direction, which the other guys pointed out.

As you might find out, that's not the only problem:

Also, make sure you're using a ListBox (http://www.lotrointerface.com/forums/showthread.php?t=1094). Mousewheel events will not fire on a Control or a Window.

Fortunis
07-10-2011, 09:13 AM
One thing I have found very handy is to use the type function.
WriteLine( type( args ) ) or you can build a function that will mine the key:data pairs out of a table. That way you just have to pass the args directly to it and you will find out all the information contained within. (really usefull when you cant figure out where the new data you inserted went)

Thanks for them tips SanDBoX *Thumbs up*


As you might find out, that's not the only problem:

Ive found many problems :p

---

Yeh i got confused with you saying mousewheel *will* fire on control. Maybe a quote from Digital_Utopia with that original comment was needed, cos i didnt realise you was correcting him. ;)