Thread Tools Display Modes
12-23-06, 07:10 AM   #1
Zeksie
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 24
Post Request XML child definitions

Would be so useful to be able to specificy a frame name thus:

Code:
<Frame name="SomeFrame">
   ...
   <Frame name="$parent.name">            -- Notice the .
So that the new frame is created with the parent's name + "name", *AND* more importantly, the sub-frame is automatically assigned to the parent frame's 'name' variable.

Then you can access the sub-frame with SomeFrame.name, without having to piss around with assigning them yourself.
  Reply With Quote
01-08-07, 07:17 PM   #2
Flickerstreak
A Deviate Faerie Dragon
Join Date: Dec 2006
Posts: 19
That's a really good idea... if it didn't set the global name (instead just storing the frame object at parent.name). It would avoid polluting the global namespace.

You can do exactly what you're describing by inheriting from the following template (provided you don't override onLoad):

Code:
<Frame name="SubClassifierTemplate" virtual="true">
  <Scripts>
    <OnLoad>
      local name = this:GetName()
      local parent = this:GetParent()
      if name and parent then
        local parentName = parent:GetName()
        if parentName then
          local subName = string.match(name,parentName.."(.+)")
          if subName then
            parent[subName] = this
          end
        end
      end
    </OnLoad>
  </Scripts>
</Frame>
So, your example would work like this:

Code:
<Frame name="SomeFrame">
   ...
   <Frame name="$parentname" inherits="SubClassifierTemplate">

Last edited by Flickerstreak : 01-08-07 at 07:27 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Wish List » Request XML child definitions


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