1. Is it possible to scan a tooltip of an item in the bank? I've tried the following code (modified from the example in the snippet)

     f = CreateFrame('GameTooltip', 'MyTooltip', UIParent, 'GameTooltipTemplate')
     f:SetOwner(UIParent, 'ANCHOR_NONE')
     f:SetBagItem(0,1)
     print (MyTooltipTextLeft2:GetText())
     f:Hide()
    

    while it works perfectly for an item that is in my bags when I change

    f:SetBagItem(0,1)
    

    to

    f:SetBagItem(-1,1)
    

    it always returns nil.

  2. It might be that the tooltip takes time to load, it might be worth making the tooltip visible and seeing it if works normally before you try getting the text from it.

  3. It might be that the tooltip takes time to load, it might be worth making the tooltip visible and seeing it if works normally before you try getting the text from it.

    Would I do that by using f:Show() (tried it but nothing seemed to change) or some other way?

  4. When you do f:Show and then set it with a bag item, does it display the bag item's info? Also, you can always dig into the FrameXML for the bank and see how it's doin git.

  5. With f = CreateFrame('GameTooltip', 'MyTooltip', UIParent, 'GameTooltipTemplate')

     f:Show()
     f:SetOwner(UIParent, 'TOPLEFT')
     f:SetBagItem(0, 1)
    

    I get a blank frame the size of the items tooltip in the upper left corner of the screen, however when I set it to f:SetBagItem(-1, 0) however not even the frame displays.

  6. Then I'd look at how the bank frame code in the FrameXML accomplishes this.

  7. Checking BankFrame all I can find seems to be

     function BankFrameItemButton_OnEnter (self)
         GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
         if ( not GameTooltip:SetInventoryItem("player", self:GetInventorySlot()) ) then
             if ( self.isBag ) then
                 GameTooltip:SetText(self.tooltipText);
             end
         end
         CursorUpdate(self);
     end
    

    which leads me to believe that bank items need to be moused over for their tooltips to show, if I'm not mistaken?

    Edit: Also I'd like to say thanks for the quick replies, I've been trying to get this to work most of the day and I wasn't getting anywhere with it.

  8. The code uses SetInventoryItem.

    GameTooltip:SetInventoryItem("player", 67) is the top-right slot in the bank.

  9. Thanks for the help =D after playing around with it a bit more I finally have a working version. Final product below

     function AM_SendableItem(bag, slot)
        local f = CreateFrame('GameTooltip', 'AM_ItemCheck', UIParent, 'GameTooltipTemplate')
        f:SetOwner(UIParent, 'ANCHOR_NONE')
        if AM_AtMail then
            f:SetBagItem(bag,slot)
        elseif AM_AtBank then
            f:SetInventoryItem("player", slot)
        end
        if AM_ItemCheckTextLeft2:GetText() == "Soulbound" then
            AM_IsSendable = false
        else
            AM_IsSendable = true
        end
        f:Hide()
     end
    
  10. Feel free to make it into a snippet that someone else might find useful in their own addons!