Create first XML layout file


#1

Hello,

I would like to maintenance my application by saving current layout and reading it.
I will also have one default layout if custom one isn’t present.
What is the best way to create those files, so I can start application for the first time?
I see they are pretty complicated, should I attempt to write them by hand?
Or maybe create CGrid, put my elements there, save layout, then remove CGrid and read prepared file? But this seems a little dumb ;p

Thanks in advance.


#2

These files are not meant to be edited by hand. The only reason they are xml is because xml is easier to read and debug than a binary stream of data.

I usually create my layouts like this:

  • When the app starts the first time: create an initial layout with the help of CGrid, CLocations or CPerspectives.
  • When the app shuts down: store the layout in a file
  • Next time the app starts: check if there is a layout file (or else recreate the initial layout).