Go to Page... |
Thread Tools | Display Modes |
05-18-09, 08:15 PM | #1 |
ScrollFrames - I haz learnd it! ..almost
Afternoon chaps,
I'm delving into the fun that is addon development for the first time. My project? A simple tool to help glyphsellers... sell... glyphs. Anyway I'm starting small and just creating a small database to track one's selling of glyphs, namely, what glyphs are in the AH, in the inv, or out of stock. The display format is just a big list, which glyphs will be added to as they are created/ah'd/etc. As there are quite a few glyphs in the game, this list will need to be scrollable. I initially thought WoW supported a portion of a frame being displayed, with the rest of the frame accessible via scroll bar, as one would read this very web page for example. However to my understanding the only method available is to have a scrollbar that records an index of its position, and for the developer to fake the rest using this information using some aptly-named FauxScrollBar widgety thing. With a ridiculous (I dare say masochistic) amount of searching, tinkering and reloadui-ing, I have managed to get this whole scroll bar thing down. Almost. When I define a scroll bar in XML but leave out the .lua code, the scroll bar is there. It exists, you can scroll up and down (to no effect), it's just a fun thing to play with in general. But it seems that when I add the lua code and all of the list entry positions (fake buttons), the scroll bar ceases to scroll. It's just a grey immobile chunk of bar, its lifeless buttons taunting me. This is where you fine lot come in: please help this twit find out where he's gone wrong! It's not just with my mod (yay?). I assembled the completed example at http://www.wowwiki.com/Making_a_scro...lFrameTemplate and loaded it up, only to have the scroll bar disabled in it as well (figures!). My code snippets are as follows. XML: Code:
<!-- The Scroll Frame --> <ScrollFrame name="$parent_ScrollFrame" inherits="FauxScrollFrameTemplate"> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="0" y="-40"/> </Offset> </Anchor> <Anchor point="BOTTOMRIGHT"> <Offset> <AbsDimension x="-34" y="10"/> </Offset> </Anchor> </Anchors> <Scripts> <OnVerticalScroll> FauxScrollFrame_OnVerticalScroll(self, offset, 16, GlyphList_Update) </OnVerticalScroll> </Scripts> </ScrollFrame> <Button name = "$parent_ScrollFrame_ButtonTemplate" virtual="true"> <Size> <AbsDimension x="150" y="16" /> </Size> <NormalFont style="GameFontHighlightLeft"/> </Button> <Button name="$parent_ScrollFrame_Button1" inherits="$parent_ScrollFrame_ButtonTemplate"> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parent_ScrollFrame"> <Offset> <AbsDimension x="0" y="0"/> </Offset> </Anchor> </Anchors> </Button> <Button name="$parent_ScrollFrame_Button2" inherits="$parent_ScrollFrame_ButtonTemplate"> <Anchors> <Anchor point="TOP" relativeTo="$parent_ScrollFrame_Button1" relativePoint="BOTTOM"> <Offset> <AbsDimension x="0" y="0"/> </Offset> </Anchor> </Anchors> </Button> .. there are 25 buttons... i'll spare you the pain .. LUA: Code:
-- can fit 25 lines in the frame function GlyphList_Update() local numGlyphs = getn(glyphData); local listOffset = FauxScrollFrame_GetOffset(Scrivener_ScrollFrame); local listIndex; local glyphName, glyphAuctionQty, glyphInvQty, glyphLastSold, glyphTotalSold; FauxScrollFrame_Update(Scrivener_ScrollFrame, numGlyphs, 25, 16 ); for i=1, numGlyphs, 1 do listIndex = i + listOffset; glyphButton = getglobal("Scrivener_ScrollFrame_Button"..i); glyphButton:SetText(glyphData[listIndex] or ""); glyphButton:SetID(listIndex); end end If the snippets aren't enough, I can post more... I've been at this for hours :\. I've looked at the previously linked wowwiki example, a few posts from this very forum, the implementations used by a couple of mods and blizzard's friends frame, and it all looks very similar. I simply cannot see why the scroll bar refuses to do anything... |
|
05-20-09, 12:43 AM | #2 |
scrollframes
These things I'm finding such a pain myself and am having probs but anyway
In the friends frame Who section, there's a small piece of code that you could try.... below. Code:
local showScrollBar = nil; if ( numWhos > WHOS_TO_DISPLAY ) then showScrollBar = 1; end another example you could try is from the lua forum.. http://www.wowinterface.com/forums/s...ad.php?t=23769 have a look at their posted code. Hope that helped! I'm new at this stuff myself..lol |
|
05-22-09, 04:53 PM | #3 |
Help Big problem about ScrollFrame !!
ok i have try over 10 hours to learn how to creat ScrollFrame,and I make a little programme to run it ,but it only creat a ScrollFrame but not the data which I want to insert it, please help me .I just read much problem about ScrollFrame in this Forum,but still cantfix it
Code:
t = {} function Frame3_OnLoad() for i=1,50 do t[i] = "Test "..math.random(100) end ScrollFrame1:Show() end function Frame1_OnLoad() this:RegisterEvent("PLAYER_TARGET_CHANGED"); end function Frame1_OnEvent() if (event == "PLAYER_TARGET_CHANGED") then FontString1:SetText("Hello " .. UnitName("target") .. "!"); end end function Button1_OnClick() Frame1:Hide(); end function Button2_OnClick() end function Frame4_OnLoad() end function Frame2_OnLoad() end function ScrollFrame1_Update() local line; local lineplusoffset; FauxScrollFrame_Update(ScrollFrame1,40,5,16); for line=1,5 do lineplusoffset = line + FauxScrollFrame_GetOffset(ScrollFrame1); if lineplusoffset < 40 then getglobal("player"..line):SetText(t[lineplusoffset]); getglobal("player"..line):Show(); else getglobal("player"..line):Hide(); end end end function Button3_OnClick() Frame4:Show(); end function Button5_OnClick() Frame4:Hide(); end Code:
<Frame name="Frame3"> <Size> <AbsDimension x="263" y="277" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset x="36" y="-57" /> </Anchor> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11" /> </BackgroundInsets> <TileSize> <AbsValue val="32" /> </TileSize> <EdgeSize> <AbsValue val="32" /> </EdgeSize> </Backdrop> <Frames> <ScrollFrame name="ScrollFrame1" inherits="FauxScrollFrameTemplate"> <Size> <AbsDimension x="224" y="159" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset x="3" y="-115" /> </Anchor> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11" /> </BackgroundInsets> <TileSize> <AbsValue val="32" /> </TileSize> <EdgeSize> <AbsValue val="32" /> </EdgeSize> </Backdrop> <Frames> <Button name="player1" inherits="MyModEntryTemplate" text=""> <Size> <AbsDimension x="224" y="30" /> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="ScrollFrame1" /> <Anchor point="TOPRIGHT" relativeTo="ScrollFrame1" /> </Anchors> </Button> <Button name="player2" inherits="MyModEntryTemplate" text=""> <Size> <AbsDimension x="224" y="30" /> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="player1" relativePoint="BOTTOMLEFT" /> <Anchor point="TOPRIGHT" relativeTo="player1" relativePoint="BOTTOMRIGHT" /> </Anchors> </Button> <Button name="player3" inherits="MyModEntryTemplate" text=""> <Size> <AbsDimension x="224" y="30" /> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="player2" relativePoint="BOTTOMLEFT" /> <Anchor point="TOPRIGHT" relativeTo="player2" relativePoint="BOTTOMRIGHT" /> </Anchors> </Button> <Button name="player4" inherits="MyModEntryTemplate" text=""> <Size> <AbsDimension x="224" y="30" /> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="player3" relativePoint="BOTTOMLEFT" /> <Anchor point="TOPRIGHT" relativeTo="player3" relativePoint="BOTTOMRIGHT" /> </Anchors> </Button> <Button name="player5" inherits="MyModEntryTemplate" text=""> <Size> <AbsDimension x="224" y="30" /> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="player4" relativePoint="BOTTOMLEFT" /> <Anchor point="TOPRIGHT" relativeTo="player4" relativePoint="BOTTOMRIGHT" /> </Anchors> </Button> </Frames> <Scripts> <OnVerticalScroll>FauxScrollFrame_OnVerticalScroll(this,offset,16,ScrollFrame1_Update);</OnVerticalScroll> <OnShow>ScrollFrame1_Update()</OnShow> </Scripts> </ScrollFrame> </Frames> <Scripts> <OnLoad>Frame3_OnLoad();</OnLoad> </Scripts> </Frame> Last edited by wolfexson : 05-22-09 at 04:55 PM. |
|
05-22-09, 10:53 PM | #4 |
If you are just looking to make a list of stuff that can scroll when needed then you are really better off just using a Slider. A ScrollFrame is really overkill for something simple like that.
|
|
WoWInterface » Developer Discussions » General Authoring Discussion » ScrollFrames - I haz learnd it! ..almost |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|