+ Reply to Thread
Results 1 to 9 of 9

Thread: Tooltips -- help

  1. #1
    Shadowlander
    Join Date
    Apr 2011
    Posts
    43

    Default Tooltips -- help

    Hey all, trying to get myself a simple addon made. I'd like to display additional information on items ingame alongside their tooltips.

    I understand we cannot modify tooltips directly to add in information so have to display our own frame alongside the native ui tooltip and I have looked at some other addons for inspiration / pointers in picking up how they solved various problems.

    I have written a little test addon in 2.2 code structure which places my desired text in a frame below the existing tooltip. Great! however it does not always work!

    After some head scratching I noticed that my new frame does not show when the native UI shows the comparison tooltip. i.e. it's comparing your currently equipped item to the item you are mousing over.

    Has anyone else come accross this problem or have any advice on how to get around it?

    My code for the tooltip was based on an ItemRarity addon by Sekoia, if it helps.

    If not I will just approach my addon from a different direction -- design my way around the limitation lol

    Thanks!

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

    Default

    There is a known bug with tooltips when a comparison tooltip is displayed. It has already been reported and zorba will get it fixed when he can.

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

    Default

    Helps a little: If you get an Event.Tooltip(event, nil), check Inspect.Time.Frame. If it is the same as the frame on which you got a non-nil tooltip, ignore it.

    Downside, any mouse movement with a comparison tooltip up will send a new (..., nil) but not the real tooltip info.
    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!)

  4. #4
    Shadowlander
    Join Date
    Apr 2011
    Posts
    43

    Default

    Thanks for the replies guys, good to know it's a known issue and being looked into. I think I'll continue and get the rest of my addon done. Probably come back to the tooltip side of it when the bugs have been addressed and in the meantime create some other method to display the information.

    Thanks!

  5. #5
    Telaran
    Join Date
    Dec 2012
    Posts
    77

    Default

    I have a work around I use right now. See if it will work for you.

    The comparison tooltip triggers the event but doesn't pass any information so here's what I do:

    Code:
    local function scrapeTooltip(_event, _ttype, _titem, _tbuff)
    	if _ttype ~= "item" and _ttype ~= "itemtype" then return end
            -- put rest of event code here
    end
    If you are working with buffs, you'll have to change the code accordingly.

    This will trigger your event and prevent subsequent calls by comparison tooltips. Another issue you want to watch is that some addons use Command.Tooltip(item) to display tooltips. If this is the case, you wont be able to attach your information to the tooltip. For that reason, I've allowed the user to detatch the tooltip and place it anywhere on his/her ui. I'm also waiting for the tooltip API to be fixed.

    Good luck!
    Last edited by Gralli; 07-31-2013 at 03:46 AM.

  6. #6
    Shadowlander
    Join Date
    Apr 2011
    Posts
    43

    Default

    Hey,

    You gave me an idea, and now I have a new problem lol

    The frame and text appear when the equipment comparison tooltip shows however the poor thing gets confused as to where it should be. It is appearing below the "currently equipped" item as opposed to the one I'm mousing over.

    I've had a go without any success is there a way to grab the correct frame / tooltip object?
    I would have thought there must be some reference to it within the calling event.

  7. #7
    Telaran
    Join Date
    Dec 2012
    Posts
    77

    Default

    Quote Originally Posted by Davtin View Post
    Hey,

    You gave me an idea, and now I have a new problem lol

    The frame and text appear when the equipment comparison tooltip shows however the poor thing gets confused as to where it should be. It is appearing below the "currently equipped" item as opposed to the one I'm mousing over.

    I've had a go without any success is there a way to grab the correct frame / tooltip object?
    I would have thought there must be some reference to it within the calling event.
    Unfortunately not, I have stopped chasing that particular bug and just allow it to sit under the currently equipped item. Once they start looking at the Tooltip functionality, I would expect some major changes so don't waste too much time on it.

    The really bad thing is, is that your addon probably wont work with a bag addon or BananAH because they call Command.Tooltip. When this is called you will get a tooltip event, but you will not have a tooltip frame to link too. So before spending too much time on tying into the actual tooltip, maybe create your own tooltip frame. Kind of hokey I know, but it will save you a lot of headaches. Trust me.

  8. #8
    Wym
    Wym is offline
    Shadowlander
    Join Date
    Jun 2012
    Posts
    25

    Default

    I had the same problem in ToonInfo - i when the user hovers the mouse over an item, i create an extra tooltip that shows which other toons have the same item in their inventory or bank. This works great with "normal" items, but not with wearables that trigger the comparison tooltip.

    After a lot of pulling my hair out, i finally gave up. Seebs' trick of checking the time frame didn't work for me either (but that was over a year ago, might have changed now).

    What i finally came up with is:

    - set the strata of my tooltip extension window to topmost so it doesn't get hidden by bags etc.

    local tooltipContext=UI.CreateContext("ToonInfoToolTip")
    -- dump(tooltipContext:GetStrataList())
    tooltipContext:SetStrata("topmost");

    tooltipExtension=UI.CreateFrame("Frame", "TooltipExtension", tooltipContext)

    - when i want to show my tooltip extension, check if the position of the real tooltip is zero, and if yes, do nothing and just set a flag

    local windowToAttachTo = UI.Native.Tooltip
    local l=windowToAttachTo:GetLeft()
    local t=windowToAttachTo:GetTop()

    -- print("show: l="..l..", t="..t)
    if (l==0 and t==0) then
    ToonInfo.HackToDelayToolTip=true
    ToonInfo.HackToDelayToolTipItemName=itemname
    return
    end

    - in Event.System.Update.Begin, if the flag is set, and try to show the extension again:

    if ToonInfo.HackToDelayToolTip then
    if ToonInfo.HackToDelayToolTipItemName ~= nil then
    ToonInfo.showTooltipExtension(ToonInfo.HackToDelay ToolTipItemName)
    else
    ToonInfo.hideTooltipExtension()
    end
    end

    - when the real tooltip is present, and i finally have decided to show my extension, attach it to where the tooltip is now:

    tooltipExtension:SetPoint("CENTERRIGHT", windowToAttachTo, "CENTERLEFT", -5, 0)
    tooltipExtension:SetVisible(true)

    This solves most problems, because it delays finding out the real tooltip position until the real tooltip is actually positioned; the first tooltip event always seems to place it at the top left of the screen (0/0). But, as Command.Tooltip doesn't move the tooltip, it doesn't work with bag addons. So, feel free to look at my source code and steal from me, but it think you'd be much better off with your own window, placed convenently somewhere, maybe with a draggable/configurable position, that shows your info. Everything else is a pita. Trust Gralli.

  9. #9
    Shadowlander
    Join Date
    Apr 2011
    Posts
    43

    Default

    Hi,

    Sounds good, I was thinking along similar lines myself. Ignore the built in tooltips, try to position my tooltip somewhere sensible depending on how close to screen edges etc so as not to clash with built in tooltips. However I had not considered the possibility of other addons at all, like bag addons who's tooltips will presumably not conform to conventional positioning.

    I will have a bash this weekend and see what I can come up with, get it working and just ignore other addon's who cause positioning conflict. Who needs them lol

    Thanks for the help and ideas!

+ 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