• 0

    posted a message on ScrollingMessageFrame odd behaviour
    Thank you for your reply. I now did it similar to what you suggested. I've integrated Ace3 in my project and set up a TreeGroup. An item in the TreeGroup represents a boss. With an OnClick handler I "populate" prepared InteractiveLabels (to show the item tooltips OnEnter). They are always there and only get their properties changed when selecting a different boss.

    Just some pseudo XML (i did not use an XML file):
    <TreeGroup data="treeData">
        <button>Request Items</button>
        <InteractiveLabel id="1" OnEnter="..." itemLink="..." ...>Item Name</InteractiveLabel>
        ..
        <InteractiveLabel id="20" OnEnter="..." itemLink="..." ...>Item Name</InteractiveLabel>
    </TreeGroup>


    When an item in the Tree is selected, every InteractiveLabel gets cleared and repopulated.
    I created 30 Labels with a for loop and put them into a table for easy access. That's it.

    By the way: Any ideas, why I can't login to this forum with my curse.com credentials? Actually I can, but at the same time not. It is very weird.

    Posted in: Lua Code Discussion
  • 0

    posted a message on ScrollingMessageFrame odd behaviour
    Hi folks,

    I'm currently developing an addon which lists all unknown transmogrification items of an instance for the current character. It does work quite well, although I dont want to list the missing items in the DEFAULT_CHAT_FRAME anymore, I want a ScrollingMessageFrame (or something similar).

    I'm new to WoW Lua (not to programming) and read quite a lot about it the last days. I find it quite an exhausting task to search all the websites like wowprogramming.com, wowwiki.wikia.com and all the boards for information. Many of them are tremendously outdated and not complete and helpful at all (beside providing some method names...). So I've found existing code pieces and put them together but discovered some bugs to the point where I decided to start from scratch.

    So I've already created a movable Frame with a Close Button attached to its bottom and I've put a ScrollingMessageFrame (SMF) into that. I can populate the SMF with values. I don't want to set up a scroll bar yet. I Just want to show x items in the SMF, starting from its top. If they exceed the bottom of the frame they just should be clipped.

    -- Frame container
    local frame  = CreateFrame("Frame", "GottaMogEmAllOutputFrame", UIParent)
    frame.width  = 500
    frame.height = 250
    frame:SetFrameStrata("FULLSCREEN_DIALOG")
    frame:SetSize(frame.width, frame.height)
    frame:SetPoint("CENTER", UIParent)
    frame:SetBackdrop({
          bgFile   = "Interface\\ChatFrame\\ChatFrameBackground",
          edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
          insets   = { left = 10, right = 10, top = 10, bottom = 10 }
    })
    frame:SetBackdropColor(0, 0, 0, 0.8)
    frame:EnableMouse(true)
    frame:EnableMouseWheel(true)
    
    -- Make movable 
    frame:SetMovable(true)
    frame:RegisterForDrag("LeftButton")
    frame:SetScript("OnDragStart", frame.StartMoving)
    frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
    
    -- Close button
    local closeButton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
    closeButton:SetPoint("BOTTOM", 0, 10)
    closeButton:SetHeight(25)
    closeButton:SetWidth(100)
    closeButton:SetText(CLOSE)
    closeButton:SetScript("OnClick", function(self)
          self:GetParent():Hide()
    end)
    
    -- ScrollingMessageFrame
    local messageFrame = CreateFrame("ScrollingMessageFrame", nil, frame)
    messageFrame:SetPoint("LEFT", 15, 20)
    messageFrame:SetSize(frame.width, frame.height - 50)
    messageFrame:SetFontObject(GameFontNormal)
    messageFrame:SetTextColor(1, 1, 1, 1)
    messageFrame:SetJustifyH("LEFT")
    messageFrame:SetFading(false)
    messageFrame:SetMaxLines(100)
    
    for i = 1, 25, 1 do
       messageFrame:AddMessage(i .. ". BORUS")
    end


    Executing this (for quick testing I use the ingame Addon WowLua) has a nice result:



    The SMF is scrolled to the bottom, but this shouldn't be a problem, regarding the methods I found.
    Now following the docs at http://wowprogramming.com/docs/widgets/ScrollingMessageFrame I use the method ScrollToTop(). Result:



    This is not the behaviour I'd expect at all. I've had it working with a scroll bar before I decided to restart, but it had (at least) this very same problem.
    After using messageFrame:ScrollToTop(), messageFrame:AtBottom() still outputs "true". I'm seriously confused. What am I doing wrong? Is an SMF outdated? Are there better ways to do this?

    EDIT: I've found out that Blizzard uses an XML file to create their SMF of the Guild Bank Transaction Tab. I'll try this out... but for a single frame in my opinion an XML file is a bit overkill...

    Edit2: Same with an XML file. ScrollToTop() shows the first list element at the very bottom and nothing else. But it actually outputs "true" from AtTop()!
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.