Thread Tools Display Modes
06-21-10, 10:32 PM   #1
Toragon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 11
FauxScrollFrame scrolling start out at the bottom

I cannot figure out why the scrolling bar starts at the bottom plus if look in the picture the bottom button is enabled and the top is not enabled.
I can drag the scroll bar to the top and then the top button becomes enabled and the bottom is not what I am I doing wrong.


Here is my code
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/FrameXML/UI.xsd">
	<Button name="MacroIconTest_IconTemplate" virtual="true">
		<Size x="34" y="24" />
		<NormalTexture name="$parentIcon" setAllPoints="true" />
		<HighlightTexture alphaMode="ADD"
			file="Interface\Buttons\ButtonHilight-Square" />
		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp")
				self:RegisterForDrag("LeftButton")
				
			</OnLoad>
			<OnReceiveDrag>
				CDB.UpdateList()
    	 </OnReceiveDrag>
		</Scripts>

	</Button>
	<Frame name="CDBOptionPanel">

		<Frames>
			<Button name="$parentIcon1" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
						<Offset x="10" y="-36" />
					</Anchor>
				</Anchors>
			</Button>
			<Button name="$parentIcon2" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon1" />
				</Anchors>
			</Button>
			<Button name="$parentIcon3" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon2" />
				</Anchors>
			</Button>
			<Button name="$parentIcon4" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon3" />
				</Anchors>
			</Button>
			<Button name="$parentIcon5" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon4" />
				</Anchors>
			</Button>
			<Button name="$parentIcon6" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT"
						relativeTo="$parentIcon1" />
				</Anchors>
			</Button>
			<Button name="$parentIcon7" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon6" />
				</Anchors>
			</Button>
			<Button name="$parentIcon8" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon7" />
				</Anchors>
			</Button>
			<Button name="$parentIcon9" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon8" />
				</Anchors>
			</Button>
			<Button name="$parentIcon10" inherits="MacroIconTest_IconTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentIcon9" />
				</Anchors>
			</Button>
			<ScrollFrame name="$parentListScrollFrame" inherits="FauxScrollFrameTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentIcon1" relativePoint="TOPLEFT" /> 
					<Anchor point="BOTTOMRIGHT" relativeTo="$parentIcon10" relativePoint="BOTTOMRIGHT"> <Offset x="-5" y="0" /></Anchor>
				</Anchors>
				<Scripts>
					<OnVerticalScroll>
						FauxScrollFrame_OnVerticalScroll(self, offset, 24, CDB.UpdateList)
          			</OnVerticalScroll>
					<OnShow>
						CDB.UpdateList()
          			</OnShow>
				</Scripts>
			</ScrollFrame>

		</Frames>
		<Scripts>
			<OnLoad>
				CDB_OnLoad(self)
			</OnLoad>
		</Scripts>
	</Frame>


</Ui>
Code:
CDB = {}
spellList ={}

 function CDB_OnLoad(panel)

      panel.name = select(2, GetAddOnInfo("CDB"))
  	  InterfaceOptions_AddCategory(panel)
    end
    
function CDB.UpdateList()

 	local name = "CDBOptionPanelIcon"
 if CursorHasItem() or CursorHasSpell() then
	 local linktype, info1, info2 = GetCursorInfo()

		local watchtype, watchname, options
		if linktype=='spell' then
			watchtype, watchname = 'spell', (GetSpellName(info1, BOOKTYPE_SPELL))
			_, _, icon = GetSpellInfo(watchname)
		end
		table.insert(spellList, icon)
 		ClearCursor()
 	 end
 		
 		 local texture
 		for line= 1,10 do
		 lineplusoffset = line + FauxScrollFrame_GetOffset(CDBOptionPanelListScrollFrame) * 5;
		
			if spellList[lineplusoffset] ~= nil then
				 texture = spellList[lineplusoffset]
			else
			texture = "Interface\\QuestFrame\\UI-QuestTitleHighlight"
			end
				local button = getglobal(name .. line)
				button:SetNormalTexture(texture)
				
		end
		 FauxScrollFrame_Update(CDBOptionPanelListScrollFrame,4,2,24);

end
  Reply With Quote
06-22-10, 03:46 AM   #2
Foxlit
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 91
Originally Posted by Toragon View Post
I cannot figure out why the scrolling bar starts at the bottom plus if look in the picture the bottom button is enabled and the top is not enabled.
It does not. Your scroll bar is simply too small to display the thumb properly; increase its height.
__________________
... and you do get used to it, after a while.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » FauxScrollFrame scrolling start out at the bottom

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off