+ Reply to Thread
Results 1 to 4 of 4

Thread: EventAttach and Detach

  1. #1
    Telaran
    Join Date
    Oct 2011
    Posts
    86

    Default EventAttach and Detach

    I am having troubles trying to allow a frame to be clickthrough when not needed.
    I have the frame set up when having a target to:

    Code:
    rhud.targetnameback:EventAttach(Event.UI.Input.Mouse.Right.Click, rhud.targetrclickmenu, "RightClick")
    and when no target to:

    Code:
    rhud.targetnameback:EventDetach(Event.UI.Input.Mouse.Right.Click, rhud.targetrclickmenu, "RightClick")
    Attaching the event will allow the Command.Unit.Menu to work fine but when using the Detach, the frame still wont clear the mouseclicks. Someone point out what I am doing wrong here please.
    Author of RiftHud, RiftActionbarCooldowns, RunecraftHelper, RiftHealer, and RiftMenuXtra. Can be found at RiftUI and Curse.

  2. #2
    Telaran
    Join Date
    Mar 2012
    Posts
    72

    Default

    If you check the EventList is the list clear, it might be a bug.

    Perhaps also take a look at setting:
    Frame:SetMouseMasking

    If you don't need the frame could you hide it with SetVisible(false) and so it's not even on screen (although that does add more complication to tracking it's visibility)

  3. #3
    Telaran
    Join Date
    Oct 2011
    Posts
    86

    Default

    Quote Originally Posted by Mere View Post
    If you check the EventList is the list clear, it might be a bug.

    Perhaps also take a look at setting:
    Frame:SetMouseMasking

    If you don't need the frame could you hide it with SetVisible(false) and so it's not even on screen (although that does add more complication to tracking it's visibility)
    MouseMasking is set to "limited", it allows left clicks through wether attached or detached.

    I added code right after the detach:

    Code:
    			result = rhud.targetnameback:EventList(Event.UI.Input.Mouse.Right.Click)
    			dump(result)
    returns: {} but still cant rightclick through that spot.

    Now...I have 2 text labels attached to that frame that I want to show wether the mouse click is enabled or not so I cant just hide the frame.

    I also added that code right after the Attach and I get results so it seems Attach and Detach must be working correctly, the frame just isnt releasing the mouse clicks.
    Last edited by TinnerKB; 08-24-2013 at 07:05 AM. Reason: Additonal
    Author of RiftHud, RiftActionbarCooldowns, RunecraftHelper, RiftHealer, and RiftMenuXtra. Can be found at RiftUI and Curse.

  4. #4
    Telaran
    Join Date
    Oct 2011
    Posts
    86

    Default Snippet

    Wrote a small code snippet in my localized LuaPad (fixed all the probs)

    Code:
    function testfunc() print("Clicked") end
    testwindow = UI.CreateFrame("Frame", "TestFrame", context)
    testwindow:SetPoint("TOPLEFT", context, "TOPLEFT", 500, 500)
    testwindow:SetBackgroundColor(1, 1, 1, 1)
    testwindow:EventAttach(Event.UI.Input.Mouse.Left.Click, testfunc, "LeftClick")
    testwindow:EventDetach(Event.UI.Input.Mouse.Left.Click, testfunc, "LeftClick")
    result = testwindow:EventList(Event.UI.Input.Mouse.Left.Click)
    dump(result)
    It creates the window, dump results is {} but if you move the screen where the window is over something clickable like a node or an npc, you cannot click through it.
    Author of RiftHud, RiftActionbarCooldowns, RunecraftHelper, RiftHealer, and RiftMenuXtra. Can be found at RiftUI and Curse.

+ 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