+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 23

  Click here to go to the first Rift Team post in this thread.   Thread: Unit frames being click-throughable?

  1. #1
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default Unit frames being click-throughable?

    Hi. In one of my latest addons, Quick Cooldowns, ability cooldowns are overlayed on the UI via the use of the Text UI frame.
    A problem that has come up is that when you overlay the numbers onto the action bar(as intended), if you click on the ability but hit the cooldown numbers, then the click attempts to be handled by my addon - not the RIFT client. Thus the ability is never casted, as it should be.

    So - how do I go about solving this? How do I make unit frames transparent? Is there a certain layer number that the default UI uses that I can go below to make my addon frames click-throughable?

  2. #2
    Plane Walker Imhothar's Avatar
    Join Date
    Feb 2012
    Posts
    439

    Default

    Look up the documentation of SetMouseMasking.

  3.   Click here to go to the next Rift Team post in this thread.   #3
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by TimeBomb View Post
    Hi. In one of my latest addons, Quick Cooldowns, ability cooldowns are overlayed on the UI via the use of the Text UI frame.
    A problem that has come up is that when you overlay the numbers onto the action bar(as intended), if you click on the ability but hit the cooldown numbers, then the click attempts to be handled by my addon - not the RIFT client. Thus the ability is never casted, as it should be.

    So - how do I go about solving this? How do I make unit frames transparent? Is there a certain layer number that the default UI uses that I can go below to make my addon frames click-throughable?
    The easiest way is to simply not have any event handlers for mouse events. If you do that, then you won't catch any events and your frames will be entirely click-through.

    If you do need certain events - say, you want to handle right-clicks while letting left-clicks through - then, as Imhotar says, you'll need to change the SetMouseMasking() setting.

  4. #4
    Rift Chaser
    Join Date
    Aug 2010
    Posts
    298

    Default

    Is there a way to make the action-bars "click through"? Never found a way...

    The problem is - i use one action-bar vertical and without the borders. But if i click on one place where the action bar would be (but is not visible) then i click the action bar and not a npc or an enemy who is behind the action-bar...
    Last edited by Delarcia; 03-14-2012 at 02:46 AM.

  5. #5
    RIFT Guide Writer Noshei's Avatar
    Join Date
    Feb 2011
    Posts
    1,886

    Default

    Quote Originally Posted by ZorbaTHut View Post
    The easiest way is to simply not have any event handlers for mouse events. If you do that, then you won't catch any events and your frames will be entirely click-through.

    If you do need certain events - say, you want to handle right-clicks while letting left-clicks through - then, as Imhotar says, you'll need to change the SetMouseMasking() setting.

    Would it be possible then to have the Text frame set to not catch the mouse events, but have it inside a frame that will catch mouse events. Now the twist, have the second frame only be intractable while the addon configuration is open.

  6. #6
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    Quote Originally Posted by TimeBomb View Post
    So - how do I go about solving this?
    You do not click! :P
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  7. #7
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Quote Originally Posted by ZorbaTHut View Post
    The easiest way is to simply not have any event handlers for mouse events. If you do that, then you won't catch any events and your frames will be entirely click-through.

    If you do need certain events - say, you want to handle right-clicks while letting left-clicks through - then, as Imhotar says, you'll need to change the SetMouseMasking() setting.
    Argh, I see. My problem is that the Text frames are movable (i.e. take up numerous mouse click events) only if a variable is set to true (i.e. they clicked the "Move" button for that frame in the config UI), otherwise they don't do anything.

    I imagine this could be easily fixed if there was a 'none' option for the MouseMasking value. But, alas, there is not.

    Is there any way I could make the numbers click-throughable while still allowing them to be moved via left click only when a certain variable is set to true?

    Edit: I think I know how this can be done, at least for my scenario. The frames are constantly being created and removed when need be (i.e. when the cooldown starts, when the cooldown ends), so, when I create the frame 'to be moved', I just create it with the events, and create all the other normal ones without the events. Set MouseMasking to limited and wa-la.
    Thanks all.
    Last edited by TimeBomb; 03-14-2012 at 12:05 PM.

  8. #8
    Plane Walker Imhothar's Avatar
    Join Date
    Feb 2012
    Posts
    439

    Default

    Haven't tried it and guess Zorba would need to confirm it, but won't setting the mouse handlers back to nil reset the click-through behavior?

  9.   Click here to go to the next Rift Team post in this thread.   #9
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Imhothar View Post
    Haven't tried it and guess Zorba would need to confirm it, but won't setting the mouse handlers back to nil reset the click-through behavior?
    Yep, this is how I'd do it.

    Quote Originally Posted by TimeBomb View Post
    Edit: I think I know how this can be done, at least for my scenario. The frames are constantly being created and removed when need be (i.e. when the cooldown starts, when the cooldown ends), so, when I create the frame 'to be moved', I just create it with the events, and create all the other normal ones without the events. Set MouseMasking to limited and wa-la.
    Thanks all.
    I'm a little worried about "created and removed" - note that frames are never garbage collected. Once you create a frame, it exists until the next UI reload. If you're just recycling it, awesome, that's what you're meant to do, but be careful about creation.

  10. #10
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Quote Originally Posted by ZorbaTHut View Post
    I'm a little worried about "created and removed" - note that frames are never garbage collected. Once you create a frame, it exists until the next UI reload. If you're just recycling it, awesome, that's what you're meant to do, but be careful about creation.
    Ah, I see.

    How I currently implement it is simply via creating a new frame in a table. I remove it by setting the text to nil, visible to false, and then the frame's table element to nil. I see now why the frame was still visible when the frame was set to nil but visible was set to true.
    I thought briefly about recycling them, but in the end, for whatever reason, I just implemented it as stated above.

    Although I haven't noticed any memory or CPU leaks whatsoever in the addon, the fact that frames aren't garbage collected is a big concern. I'll change my implementation to just set them as invisible when not in use if they are already created - instead of constantly 'deleting' and creating.

    Thanks for the info.

  11. #11
    Telaran
    Join Date
    Mar 2012
    Posts
    72

    Default

    Quote Originally Posted by ZorbaTHut View Post
    I'm a little worried about "created and removed" - note that frames are never garbage collected. Once you create a frame, it exists until the next UI reload. If you're just recycling it, awesome, that's what you're meant to do, but be careful about creation.
    Will frames ever be GC'd?

    It sounds like I should design to have a bucket of UI objects (which contains frames), if the bucket is empty make a new one, as I finish with them put them in the bucket for reuse. Should we ever be able to GC frames the bucket api could be streamlined I guess.

    Actually should I split out frames, text and textures into different buckets, calling ClearAll on each one?

    I guess it also makes sense to only create UI as needed, eg don't bother making config dialogs unless someone asks for it. A lot of addons seem to pre-generate all their frames up front though.

    Thanks,
    Mere

    PS Sorry for hijacking the thread

  12. #12
    Rift Disciple
    Join Date
    Jan 2011
    Posts
    147

    Default

    Quote Originally Posted by Mere View Post
    Will frames ever be GC'd?

    It sounds like I should design to have a bucket of UI objects (which contains frames), if the bucket is empty make a new one, as I finish with them put them in the bucket for reuse. Should we ever be able to GC frames the bucket api could be streamlined I guess.

    Actually should I split out frames, text and textures into different buckets, calling ClearAll on each one?

    I guess it also makes sense to only create UI as needed, eg don't bother making config dialogs unless someone asks for it. A lot of addons seem to pre-generate all their frames up front though.

    Thanks,
    Mere

    PS Sorry for hijacking the thread
    I have a library lying around here somewhere that does this. I abandoned it a while back because there were some aspects of frames which couldn't be properly reset when a frame was recycled. I can't remember exactly what the problem was but it may have been related to default sizes and stuff like that, which has changed in recent Rift versions so it may actually work better now.

  13. #13
    Plane Walker Imhothar's Avatar
    Join Date
    Feb 2012
    Posts
    439

    Default

    Usually you have frames for specific purposes. I cache the frames representing items in my addon separately from the group labels as it would be too cumbersome to dissect and reassemble them from their basic parts. Besides, these objects hold other information which is related to their function. Assuring these states never conflict is just too much work IMHO.

  14.   Click here to go to the next Rift Team post in this thread.   #14
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Mere View Post
    Will frames ever be GC'd?
    Frames won't ever be GC'ed. We might add an explicit "destroy this frame" function. GC'ing frames is a rather knotty problem and I'm not sure it's really solvable


    Quote Originally Posted by dOxxx View Post
    I have a library lying around here somewhere that does this. I abandoned it a while back because there were some aspects of frames which couldn't be properly reset when a frame was recycled. I can't remember exactly what the problem was but it may have been related to default sizes and stuff like that, which has changed in recent Rift versions so it may actually work better now.
    I know there were a few problems along these lines which are now fixed (the existence of :GetChildren(), for example). If you get back to the library and there's more issues, let me know.

  15. #15
    Rift Disciple
    Join Date
    Jan 2011
    Posts
    147

    Default

    Quote Originally Posted by ZorbaTHut View Post
    I know there were a few problems along these lines which are now fixed (the existence of :GetChildren(), for example). If you get back to the library and there's more issues, let me know.
    Ah, GetChildren... Excellent, Smithers. That's one gross hack I can remove.

    You wouldn't happen to have added a SetName function to Element? That was another missing piece -- I couldn't set the name of a recycled frame to the new name requested by the user.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

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