+ Reply to Thread
Results 1 to 4 of 4

Thread: Detecting mouse events on Native frames?

  1. #1
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default Detecting mouse events on Native frames?

    I have a need/want to detect the mouse wheel being used over a native frame. UI.Native.MapMain specifically.

    I want to be able to detect when the map scale has changed, and in lieu of any API functions to do so, detecting that the scroll wheel has been used would seem to be a workaround.

    However attaching the wheel event directly to the native frame doesnt seem to work:

    Code:
    	UI.Native.MapMain:EventAttach(Event.UI.Input.Mouse.Wheel.Forward, function(self, h)
    		print("Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward")
    At no point when using the wheel on the map, do I get a 'Wheel forward' message displayed.

    So, my next though was to place an overlay over the top of the map window, and catch the events there.

    Code:
    	LM.UI.overlay:EventAttach(Event.UI.Input.Mouse.Wheel.Forward, function(self, h)
    		print("Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward")
    This works, and I get the messages. However it also eats the event, which then never reaches the underlying frame.

    Is it possible to pass these events on?

    I tried using ive(), but all I get is errors, so clearly I'm doing something wrong =P
    Last edited by Adelea; 07-10-2013 at 02:13 AM.
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  2. #2
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    I've also tried attaching a handler to the .Dive and .Bubble events for the mouse wheel on both the overlay and native frame - neither of which ever seems to get called.

    Code:
    	UI.Native.MapMain:EventAttach(Event.UI.Input.Mouse.Wheel.Forward.Dive, function(self, h)
    		print("Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward.Dive")
    
    	UI.Native.MapMain:EventAttach(Event.UI.Input.Mouse.Wheel.Forward.Bubble, function(self, h)
    		print("Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward.Bubble")
    
    	LM.UI.overlay:EventAttach(Event.UI.Input.Mouse.Wheel.Forward.Dive, function(self, h)
    		print("Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward.Dive")
    
    	LM.UI.overlay:EventAttach(Event.UI.Input.Mouse.Wheel.Forward.Bubble, function(self, h)
    		print("Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward.Bubble")
    Am I fundamentally missing something, or is what I am trying to do, just not possible ?

    From reading The Event Redesign Post, specifically:

    Along with everything listed above, frame input events will be gaining "Dive" and "Bubble" phases. On trigger, and starting with UIParent, the appropriate (eventname)Dive event will be triggered, followed by the appropriate child, until it reaches the actual frame that received the real event. The real event will trigger, and then the process repeats in reverse, this time with (eventname)Bubble. So, assuming a hierarchy of UIParent->context->container->target, the following events will trigger, in order:

    Code:
    (User left-clicks on "target")
    UIParent:Event.UI.Input.Mouse.Left.Click.Dive
    context:Event.UI.Input.Mouse.Left.Click.Dive
    container:Event.UI.Input.Mouse.Left.Click.Dive
    target:Event.UI.Input.Mouse.Left.Click.Dive
    target:Event.UI.Input.Mouse.Left.Click
    target:Event.UI.Input.Mouse.Left.Click.Bubble
    container:Event.UI.Input.Mouse.Left.Click.Bubble
    context:Event.UI.Input.Mouse.Left.Click.Bubble
    UIParent:Event.UI.Input.Mouse.Left.Click.Bubble
    It seems to suggest that UIParent will fire a Bubble event at the very end.

    Well, that doesnt seem to happen either!

    Code:
    	UIParent:EventAttach(Event.UI.Input.Mouse.Wheel.Forward.Bubble, function(self, h)
    		print("UIParent: Wheel forward")
    	end, "Event.UI.Input.Mouse.Wheel.Forward")
    Again, doesnt get fired.
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  3. #3
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    After a bit more experimentation, it seems the UIParent:...Bubble() does fire for UI.CreateFrame() frames.

    So, the conclusion I come to, is that UI.Input events dont work on UI.Native frames.
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  4. #4
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    I believe that is the case, yes. This is why we need a map API.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts