New win32lib and XML
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 05, 2004
- 426 views
The new win32lib iirc is going to have some major changes to the way controls can be specified (so I guess this is mainly aimed at Derek). During my trawls on the web, one thing that seems increasingly to be a jolly good idea is to store gui layouts in a separate file, and xml is probably not the worst choice. An example is: <?xml version="1.0"?> <dialog caption="Dialog Example" top="0" left="0" width="320" height="200" style="popup,clipsiblings,caption,sysmenu,modalframe, 3dlook,setfont" fontname="Comic Sans MS" fontsize="10"> <control class="Static" top="29" left="32" width="70" height="11">Static Text Example</control> <control class="Edit" top="76" left="32" width="78" height="14" style="not border" id="1000"></control> <control class="Picture" top="96" left="32" width="32" height="32" style="icon" resource-id="128"/> <control class="Button" top="179" left="86" width="50" height="14" id="1">&OK</control> <control class="Button" top="179" left="183" width="50" height="14" id="2">&Cancel</control> <control class="ActiveX" top="26" left="130" width="128" height="118" id="1009" clsid="{6262D3A0-531B-11CF-91F6-C2863C385E30}"/> </dialog> (from http://www.codeguru.com/advancedui/XMLGUI.html though I really hate the idea of use "1", "2", "1000", and "1009" as control id's). The major downside is that you can't link handlers directly to controls. On the plus side, it divorces the gui alot more from the application code, making it much easier to translate to another language, remove (make invisible) a field not used by a particular client, etc. I haven't yet managed to find a common format for such a file (is there one for wxWindows?) or a layout editor which stands out, maybe Judith's IDE could be hacked? Comments, anyone? Pete