Thread Tools Display Modes
09-27-05, 06:55 PM   #1
Zeelah
A Defias Bandit
Join Date: Sep 2005
Posts: 3
Multiple frames, or frame reuse...

I'm currently creating a custom dkp mod for our guild.

Anyway, I've read where someone explained that all frames have to be declared, and cannot be created on the fly.

Does that mean that it is not possible to have a system with an arbitrary number of frames, given that only one is ever going to be displayed at any one time?

So, rather than having many frames, the same frame is being re-used every time it is displayed? If this is possible, how would you go about making the buttons/editboxes/scrollframes react correctly for the given instance of the frame? Is it possible to change the id for a frame, or is it not necessary?

Ie, if there's a main frame, with a scrollframe listing stored raids. Select one, hit the edit button. The raid-details frame would show with the details from that raid - and the button on the raid-details frame would need to cause the correct functions to run on that raid only.

Or is it simply more practical to limit the mod to only store say, 10 raids, and define all ten (using a template)?

Just trying to get my head around handling the wow ui.
  Reply With Quote
09-28-05, 04:09 AM   #2
Kasheen
A Wyrmkin Dreamwalker
 
Kasheen's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 58
You are correct in saying that frames can only be created at design time.

This might seem odd in an event oriented programming language but you have to think of the code behind the scenes as something separate completely from your GUI, that will help you keep things in variables rather than storing things on the GUI. With that in mind if you had a bunch of raids saved you could load each on onto a single display frame, when data is loaded to the display just remember what raid number the user is looking at so that if they make changes you can modify that raid ID within your saved data. That way you will only need one frame.

Now for things like scroll frames, for instance like your friends list you'll notice there is no limit to the amount of items you can have in that list. That isnt because each slot is defined in lua but rather because its a trick. Each friend you can click is a button, your friends are stored in a table, as you click up and down the list you are just changing the offset of which friends are shown, for instance at one moment you'll show friends 1 - 5 but then when you click down you will be showing friends (1+1) - (5 + 1) ie friends 2 - 6.

So in short yes, you have to find ways to reuse your frames if you are going to need an undefined number of raids to be stored
  Reply With Quote
09-28-05, 03:14 PM   #3
Zeelah
A Defias Bandit
Join Date: Sep 2005
Posts: 3
Originally Posted by Kasheen
YWhen data is loaded to the display just remember what raid number the user is looking at so that if they make changes you can modify that raid ID within your saved data. That way you will only need one frame.
Ah. *click*

Of course, I can do an <OnClick> for the button that stores the id the the given raid, and those details are put into the raid details from when the $parent_RaidList_EditRaid_Button is clicked.

Thanks.
  Reply With Quote
09-28-05, 04:51 PM   #4
Kasheen
A Wyrmkin Dreamwalker
 
Kasheen's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 58
This tutorial may also help you in getting a scrollable list:

http://www.wowwiki.com/HOWTO:_Make_a...lFrameTemplate

once you have the list and know how to pick a raid ID its simply just pulling the correct raid data out of your table, for instance if you had a table like Raid[ID][Data] then when you click the button to edit it takes the current raid and then just pulls the data out of the table and puts it on the display.
  Reply With Quote
10-13-05, 03:46 AM   #5
Zeelah
A Defias Bandit
Join Date: Sep 2005
Posts: 3
Thanks for your help. I have it all up and running, and behaving properly.

<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"/> helps with mouseover.

Regarding selecting the 'raid'... my plan was to change the highlight of the buttonframe selected by onclick, to show which raid was currently selected. However, am I right in thinking that I would then have to write code to handle correctly highlighting the appropriate frame when you scroll up and down the frame?

Is it simply easier to have a button on each buttonframe in the scrollframe - an "edit this raid" button?

I can understand how to store which buttonframe is clicked, and translating that to a particular raid by checking the scrollframe offset, but it seems like a lot of work to highlight the correct frame, just to provide user feedback on the selected raid when scrolling.

There isn't a function in there already to help with that?
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Multiple frames, or frame reuse...


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