• 0

    posted a message on [AceGUI] Problem with ScrollFrame

    Okay, I found a solution myself. I simply added

     

    RPM_mainManFrm.scroll:DoLayout()

     

    as last line into the function RPM_updateMainManFrm().

     

    Posted in: Lua Code Discussion
  • 0

    posted a message on [AceGUI] Problem with ScrollFrame

    Greetings,

     

    In an addon I am currently working on, I encountered a problem with the ScrollFrame. I use the Ace-Addon to create my Frames and I use the ScrollFrame filled with an arbitrary amount of sub elements:

     

    https://imgur.com/a/aCiqBlB

     

    As you can see, the scrollbar slider is at the bottom, but the last element is only partially visible.

     

    Here is my code. The crucial part is more or less the same from the example of the AceGUI-Tutorial-Page that demonstrates how to setup a scroll frame: https://www.wowace.com/projects/ace3/pages/ace-gui-3-0-widgets

    function RPM_addScrollBox(p,layout)
      local container = AceGUI:Create("InlineGroup")
      container:SetFullWidth(true)
      container:SetHeight(400)
      container:SetLayout("Fill")
      p:AddChild(container)
    
      local scroll = AceGUI:Create("ScrollFrame")
      scroll:SetLayout(layout)
      scroll.width = "fill"
      scroll.height = "fill"
      container:AddChild(scroll)
      return scroll
    end
    
    function RPM_addLabel(text,p,font,height,flags)
      local l = AceGUI:Create("Label")
      l:SetText(text)
      l.width = "fill"
      l:SetHeight(height*1.5)
      if font ~= nil then
        l:SetFont(font, height, flags)
      end
      p:AddChild(l)
      return l
    end
    <br />function RPM_addButton(label,w,p,func)<br /> local button = AceGUI:Create("Button")<br /> button:SetText(label)<br /> button:SetWidth(w)<br /> button:SetCallback("OnClick", func)<br /> p:AddChild(button)<br /> return button<br />end<br />
    function RPM_addInlineGroup(title,layout,p)
      local box = AceGUI:Create("InlineGroup")
      box:SetLayout(layout)
      box:SetTitle(title)
      box:SetRelativeWidth(1)
      p:AddChild(box)
      return box
    end
    
    function RPM_closeMainManFrm()
      RPM_mainManFrm:Release()
      RPM_mainManFrm:Hide()
      RPM_mainManFrm=nil
    end
    
    function RPM_openManager()
      local f=RPM_drawBaseFrame("RPManager", RPM_closeMainManFrm)
      RPM_addButton("New Quest",200,f,RPM_setNewQuest)
      f.scroll = RPM_addScrollBox(f, "List")
      RPM_mainManFrm=f
      
      RPM_updateMainManFrm()
    end
    
    function RPM_updateMainManFrm()
      if RPM_mainManFrm == nil then
        return
      end
    
      for questID, quest in pairs(RPManagerMyQuests.quests) do
        local iBox = RPM_addInlineGroup("", "Flow",RPM_mainManFrm.scroll)
        RPM_addLabel(quest.title,iBox,"Fonts/ARIALN.ttf",20)
        RPM_addLabel("Chapters: "..#(quest.chapters),iBox, "Fonts/FRIZQT__.ttf",16)
        RPM_addButton("Edit",200,iBox,function() RPM_openQuestManFrm(questId) end)
        RPM_addButton("Delete",200,iBox,function() RPM_deleteQuestFromManager(questId) end)
      end
    end

     So what can I do?

    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.