View Single Post
04-28-23, 06:46 AM   #1
AeroMaxxD
An Aku'mai Servant
Join Date: Dec 2022
Posts: 33
Adding a ScrollFrame to a CharacterFrame tab

So I am trying to write my first addon, it would just list a table of results 2 columns on the tab.

My initial idea was to have next and previous buttons to look through the results.

But I have since discovered there is a scroll frame, so was wanting to use a scroll frame instead.

The table itself will have 1 row added to the results for each day that the character was logged into.

A scroll frame should be ok right if it had a lot of data, as in a year or more?

Lua Code:
  1. local TabName="AMD";
  2. local TabID=CharacterFrame.numTabs+1;
  3. local Tab=CreateFrame("Button", "$parentTab"..TabID, CharacterFrame, "CharacterFrameTabTemplate", TabID);
  4. PanelTemplates_SetNumTabs(CharacterFrame, TabID);
  5. Tab:SetPoint("LEFT", "$parentTab"..(TabID-1), "RIGHT", -16, 0);
  6. Tab:SetText(TabName);
  7. -- Tab:SetID(TabID);
  8.  
  9. tinsert(CHARACTERFRAME_SUBFRAMES, "AMD_TabOnCharacterFrame");
  10.  
  11. hooksecurefunc("CharacterFrameTab_OnClick", function(self, button)
  12.     if self:GetID() == TabID then
  13.         ToggleCharacter("AMD_TabOnCharacterFrame")
  14.     end
  15. end)

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd">
	<Frame name="AMD_TabOnCharacterFrame" parent="CharacterFrame" frameStrata="HIGH" enableMouse="true" movable="true" setallpoints="true" id="4">
		<Size x="206" y="580"/>
		<Frames>
			<Frame name="$parent_History" parent="AMD_TabOnCharacterFrame">
				<Size x="300" y="325"/>
				<Anchors>
					<Anchor point="CENTER" relativePoint="CENTER" relativeTo="CharacterFrame"/>
				</Anchors>
				<Frames>
					<Frame name="$parent_ScrollFrame" parent="AMD_TabOnCharacterFrame_History" inherits="UIPanelScrollFrameTemplate">
					</Frame>
				</Frames>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="History_Title" parentKey="History_title" inherits="GameFontNormal">
							<Color r="1" g="1" b="1" a="1"/>
							<Anchors>
								<Anchor point="TOP">
									<Offset x="0" y="20"/>
								</Anchor>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
			</Frame>
		</Frames>
	</Frame>
</Ui>
This gives me errors and I have no idea what they mean.

Code:
Interface/SharedXML/SecureUIPanelTemplates.lua:64: attempt to call method 'SetVerticalScroll' (a nil value)
Code:
Interface/SharedXML/SecureUIPanelTemplates.xml:120 Frame AMD_TabOnCharacterFrame_History_ScrollFrame: Unknown script element OnScrollRangeChanged
Code:
Interface/SharedXML/SecureUIPanelTemplates.xml:121 Frame AMD_TabOnCharacterFrame_History_ScrollFrame: Unknown script element OnVerticalScroll
  Reply With Quote