Suggestion: Definable User Data in XML files.

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Suggestion: Definable User Data in XML files.

Postby Van » Sat Aug 20, 2005 13:07

I don't know if this is possible or not in the current release. I was looking through the API and I didn't see anything that could do this.

It would be nice to be able to define user data in the layout files. We are attepting to use the NAME of the widget to store information but that is becoming extremely difficult as the system becomes more complex. And when dealing with Non-Techies, its very difficult for them to understand the extreme importance in getting the name of the the widiget correct and in the correct order. To simplify mine and their lives, here is what I think would be nice.

It would be nice to have the ability to set user data in the XML file using a KEY/VALUE pair. Here is an example:

Code: Select all

<Window Type="TaharezLook/Button" Name="FileDialog/OK">
<Property Name="AbsoluteRect" Value="l:12.000000 t:657.000000 r:115.000000 b:695.000000" />
<Property Name="RelativeRect" Value="l:0.011953 t:0.855052 r:0.111953 b:0.905052" />
<Property Name="Text" Value="OK" />
<Property Name="Visible" Value="True" />

<Property Name="KeyValue" KeyName="MyKeyName1" KeyData="MyKeyData1" />
<Property Name="KeyValue" KeyName="MyKeyName2" KeyData="MyKeyData2" />
<Property Name="KeyValue" KeyName="MyKeyName3" KeyData="MyKeyData3" />

</Window>


Note the KeyValue (call it anything you want, this is just an example). When CEGUI reads this in, it stores this information as a KEY/VALUE pair and the user will use an Interator or something to get this data. I would think the KEY/VALUE is stored at the CEGUI::Window level so that all widgets can have their own data.

Why do this? Well, it could make designing menus and screens alot more flexible and dynamic. You can bind user data and events to widgets and use a more univeral code. And it makes it easier for non-techies to edit the XML file too.

Anyway, just a suggestion.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Suggestion: Definable User Data in XML files.

Postby CrazyEddie » Sat Aug 20, 2005 18:26

It's not possible in the current release, though it will be possible to do something similar in 0.4.0 via some things that were put in for the "Falagard" extensions.

Basically, in the look'n'feel XML skin files you can add new properties to a window type and later access those new properties from layout XML and code.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: Suggestion: Definable User Data in XML files.

Postby Van » Sun Aug 21, 2005 19:13

I'm not sure that your implementation will do what I would like.

For example, if the widget is a BUTTON and we want to assign a hotkey to the button, it would be nice to say something like this:

Code: Select all

<Property Name="KeyValue" KeyName="Hotkey" KeyData="G" />


or what about this:

Code: Select all

<Property Name="KeyValue" KeyName="DBLCLICK" KeyData="myEventName" />


There is a million things you could do with such a simple key/value pair.

Right now, the library is very rigid. Everything has to revolve around the widget name.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Suggestion: Definable User Data in XML files.

Postby CrazyEddie » Sun Aug 21, 2005 20:55

As I already said, the new abilities allow you to specify new properties via XML. This is put into the looknfeel file that defines the widget specifics.

Using your examples, new property definitions would be placed in the xml looknfeel for a button type, which looks like this:

Code: Select all

<PropertyDefinition name="HotKey" />

and this:

Code: Select all

<PropertyDefinition name="DBLCLICK" />


Then from within the XML layout, you use the new properties as you would any other:

Code: Select all

<Property Name="HotKey" Value="G" />
<Property Name="DBLCLICK" Value="myEventName" />


The system also allows you to set defaults for the new properties:

Code: Select all

<PropertyDefinition name="ReadOnlyBGColour" initialValue="FFDFDFDF" />


Since these are 'real' properties (although dynamically created), and not some cheap hack, they work in all instances other 'normal' properties do, and even get written out to XML layouts using the new XML writing abilities. Hardly what I'd call "very rigid" - maybe next time you should actually look at the new abilities before criticising.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: Suggestion: Definable User Data in XML files.

Postby Van » Tue Aug 23, 2005 00:38

Ah, OK. yes, that is what I want. I either mis-read your post or I didn't understand. Probably too much :pint: ;)

Yes, that will work great. I look forward to its release.
Please stop automatically logging me out of the forums!


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 14 guests