Scrolling frames.
Anyone have suggestions on where to start with making scrolling frames? Working on in game help system. trying to make two, the left fame with text buttons that are the various section titles when clicked on it would load the text for that header into the frame on the right. both frames would need to be scrollable.
|
Pretty sure there is a WoWAce Lib which helps with the creation of exactly this. Don't recall the name off hand though.
|
Well it looks like dewdroplib has scroll frame templates in it but i cant find any decent documentation on it. Im using the optionsassist lib by vrul and the AceGUI lib's already which also has scroll frame templates in it but im not sure how to get my help window frame to use it lol.
|
here is what i am currently using (pick and chose the sections you want)
Code:
local addonname, addon = ... then all you have to do is change the height of the child and the rest gets set by the template blizzard gives us (everything you want scrolled needs to be anchored and parented to he child frame) If you go the route of the template then you need to give the frame a name otherwise it will simply toss errors at you. |
ooooo an all lua no library necessary version! exactly what i was looking for. I will play with this see if i can get it to work :) thank you!
Just looking at it... that register widget part? does the bliz api understand that or is that a function coming from elsewhere? what exactly does registerwidget do? |
Quote:
Recycler looks like this Code:
local addonname, addon = ... |
Here's one of my more simple versions of a scroll frame I've used in one of my mock up addons to play with stuff. It's loosely based on the scroll frame code I created for my ScrollingWatchFrame addon but literally just the bare bones.
frame is whatever container frame you want to use to confine the visual part of the scrolling area. scrollFrame is the scrolling area itself which can be bigger than the container frame. scrollChild is the frame you do all the work with and assign it to the scrollFrame as a child so that the scrollFrame's scrolling allows you to see parts for the scrollChild's frame. scrollBar is a pointer to the built in scroll bar component of the base template UIPanelScrollFrameTemplate which handles most of the basic functionality. scrollSize is a variable to hold the height I want the scrollFrame to be but I assume it could be similarly used as width if you have a horizontal scrollbar rather than a vertical one. Code:
frame.scrollSize = missingCount * 40 |
The "real" scroll frame template (not the faux one) is pretty self-explanatory.
Create a scroll frame derived from UIPanelScrollFrameTemplate and a content host: lua Code:
*: If your main window / scroll frame layout is resizable and your scroll frame unidirectional make sure to resize the content host when the scroll frame's size changed: lua Code:
After you fill your scroll child with content make sure to set the points lua Code:
That's like 10 lines of code. Idk why you would need a library for this. And since your content is so static, you don't need to recycle anything neither. All you really do is lua Code:
|
i got the scroll frames down that was easy... now im fighting with my old nemesis again... tables and creating lots of frames based on table entry's...
What im trying to do now is make it so that i add buttons and their corresponding big chunk of text within a table so i can add buttons and change text within the table and never mess with anything else again. So of course i need to have it set up the buttons in the left scrollframe according to number of table entry's... the tricky part starts to be when i try to later have it do the settext stuff... my real problem lies within the use of names in the global space because i still seem to be confused about what doing something.something.something = something.something:createsomething(blahblahblah, itsname, blahblah) does and how come i cant make changes to the frame later by the name in the itsname location and can only use the something.something.something to call it again and when im forced to use the something.something.something is it possible to put variables into the .somethings somehow? this is what i have it doesnt not work this way or at lest this is the chunk im playing with if i showed the whole thing you'd see lots of commented out stuff and nonsense from me trying to figure it out. You can see the table at the top. right now im just trying to get the text to show up and figure out what method of something.something = createsomething(name) i need to use in order to use the names later outside of that for statement... i did get it to work by writing out each button but... thats a pain and lots of unnecessary lines of code... Obi-Vrul-Kanobi is prolly gonna show up and shake his head at me considering hes tried to explain this to me a few times lol. lua Code:
|
for bnid = 1, #HelpHeaders do
LeftScrollBar.scrollChild.button = CreateFrame('button', "HHeaderButton" .. bnid, LeftScrollBar.scrollChild) LeftScrollBar.scrollChild.button.text = LeftScrollBar.scrollChild.button:CreateFontString("HHeaderButtonText" .. bnid, 'DIALOG') LeftScrollBar.scrollChild.button.text:SetFont([[Fonts\FRIZQT__.TTF]], 14) LeftScrollBar.scrollChild.button.text:SetPoint("CENTER", LeftScrollBar.scrollChild.button, "CENTER", 0, 0) LeftScrollBar.scrollChild.button.text:SetTextColor(.50, .90, .80, 1) end My bigest question is... where it is setting "HHeaderButton" .. bnid which should make the name of the frame HHeaderButton1 right, so what do i use later to access it? LeftScrollBar.ScrollChild.button.HHeaderButton1? or just HHeaderButton1 or ugh... |
Code:
LeftScrollBar.scrollChild.button = CreateFrame('button', "HHeaderButton" .. bnid, LeftScrollBar.scrollChild) You should do something like this Code:
LeftScrollBar.scrollChild.button[bnid] = CreateFrame('button', "HHeaderButton" .. bnid, LeftScrollBar.scrollChild) |
so then this should set the first button's text to general right? its telling me on the settext line that button1 does not exist... i also tried being literal and putting button[1] but then it tells me "button" does not exist.
lua Code:
i think the method of using LeftScrollBar.scrollChild.button[bnid] is not right for some reason. |
Assuming you wanted to make a table of buttons then yes you are doing it right. However, just in case I would add the following line just above this one :
LeftScrollBar.scrollChild.button[bnid] = CreateFrame('button', "HHeaderButton" .. bnid, LeftScrollBar.scrollChild) LeftScrollBar.scrollChild.button = LeftScrollBar.scrollChild.button or {} Then assuming bnid is a value it will give the table an index linked list of buttons. To access you would do something like: LeftScrollBar.scrollChild.button[1] and not LeftScrollBar.scrollChild.button1 unless that is something in tables I haven't come across yet. |
LeftScrollBar.scrollChild.button1 will not work (and as always you have to make sure that you create your tables before using them otherwise you will get errors :D)
|
The table does not actually have the buttons it only contains the name of the button and the big chunk of help text that corresponds with that button.
Ive run into this problem before... i think i need to be turning the bnid part into a string for the something.somethings then back to a table entry but pull the table entrys string name for the set text's and such... local HelpHeaders = { --button name = bulk help text ['General'] = 'blahblahgeneral', ['Buttons'] = 'blahblahbuttons', ['Frame Mover'] = 'blahblahmover', ['Chat'] = 'blahblahchat', ['Tooltips'] = 'blahblahtooltips', ['Unit Frames'] = 'blahblahunitframes', ['Backpack'] = 'blahblahbakpak', ['DashBoard'] = 'blahblahdashboard', ['HUD'] = 'blahblahhud', ['Development'] = 'blahblahdevtools', } |
Even if you want to access the bnid as a string it is still technically a table element.
EG. Code:
tblName = {} Code:
tblName = { |
i think it boils down to your understanding of how lua tables work and are constructed http://www.lua.org/pil/3.6.html would be a usefull read for you
|
okay so this is not supposed to point to the table but rather be a simple string added to button LeftScrollBar.scrollChild.button[bnid] so how would that be done? ."button".. bnid?
my understanding was that for bnid = 1, #HelpHeaders do just gets the number of entrys in the table so bnid should just be 1-number of table entrys. and should be a string only. then for the settext it should be HelpHeaders[1] and that would pull general from the table correct? |
Okay, using your example of :
Code:
local HelpHeaders = { Code:
for name,caption in pairs(HelpHeaders) do LeftScrollBar.scrollChild.button["General"] with text as 'blahblahgeneral' LeftScrollBar.scrollChild.button['Buttons'] with text as 'blahblahbuttons' LeftScrollBar.scrollChild.button['Frame Mover'] with text as 'blahblahmover' LeftScrollBar.scrollChild.button['Chat'] with text as 'blahblahchat' LeftScrollBar.scrollChild.button['Tooltips'] with text as 'blahblahtooltips' LeftScrollBar.scrollChild.button['Unit Frames'] with text as 'blahblahunitframes' LeftScrollBar.scrollChild.button['Backpack'] with text as 'blahblahbakpak' LeftScrollBar.scrollChild.button['DashBoard'] with text as 'blahblahdashboard' LeftScrollBar.scrollChild.button['HUD'] with text as 'blahblahhud' LeftScrollBar.scrollChild.button['Development'] with text as 'blahblahdevtools' LeftScrollBar.scrollChild.button['Development'] of course can also be accessed by using LeftScrollBar.scrollChild.button.Development after it is created but during the creation routine it needs to be in the [] due to it being a variable and not a physical string. Hopefully that will be enough for you to see what may need changing in your code to get it to do what you want. Just replace the value with the variable that holds the value you want displayed. |
hmm so is it possible to change the table from variables to physical strings? Like within the table? i know on my frame mover system that vrul helped me with we made the options frame display the list of table entrys as though they were just string entrys.
|
All times are GMT -6. The time now is 07:44 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI