[Glade-users] Semi-dinamical UIs



On Sat, 2009-10-17 at 11:27 +0100, David L?pez Luengo wrote:
Hi there!

I'm starting to use glade and I get a doubt about it's potential.
Figure out this situation, I have a part of UI in my application that
is allways the same, so I can develop it with glade, but there is some
other parts that need to be develop AFTER the user introduce to the
program some data. In my case I will try to read an xml description of
certain structures and then I want to create (for example) a box with
buttons inside it for each field in the structure, give them names
properly as the xml description says, let the user add values to the
fields, link tooltips to each field and much more functionality. We
could understand this as a "semi-dinamical" UI's, I mean "semi"
because all this data will be read at start time, not the whole
runtime, but neither at develop time, so I don't know if I could use
glade to do this... templates or something like this. Do you know if
this kind of stuff is pretencious with glade?

There's no templates. You can move your code which creates dynamic UI
into a custom widget. This widget then would read xml description of
your structures and create internal child widgets for each field based
on that. Then you can add this widget to glade through use of a catalog.

Even better, if you have full control over your xml structure
description, then you can make it to be actually GtkBuilder xml. Say you
define object "record" which would hold list of "field" objects with all
required properties, and your custom widget then would create internal
child widgets to reflect your "record" object structure instead of
having to parse xml. This way you can edit and save whole record
definitions directly with glade if you'd wish to do so. Really neat
feature by the way.

In any case you still have to write the code which creates these
internal widgets, so it is up to you to decide if your time worth to be
spent on moving this code to a custom widget. If you have any experience
writing custom widgets, then it shouldn't take too much time, otherwise
go for it only if you want to gain such experience and don't have any
deadlines set.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]