Re: Making UI creation easier?
"Henry Merryweather" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <001e01c4ce40$0b025eb0$0300a8c0@eveshampc> |
It is interesting to see the various comments and suggestions about how to build Tk GUIs as quick as possible. I have developed a technique where I use a spreadsheet to define the GUI which is processed by my own Perl module. I can now have GUI's with a number of widgets including: * Tabbed and ordinary frames * Labels * Option menus including the 'native' type * Entry boxes * HLists and normal Lists * Radio buttons * Buttons * Dialogbox * Checkbuttons * Text For each widget I store: * the appropriate specific data (for example all the choices available for a pull down menu); * general data such row and column positions (since I use the grid geometry placing which works very efficiently) and names of any call backs or bound subroutines. I have not included all options, for example I have not allowed any colours to be defined but it would be possible to be included these if needed. In many applications, I need to change the contents of the GUI when some 'choice' has been made. I have found that I can define the required behaviour in a spreadsheet whose data is used by a call back. This is not really connected to the definition of the GUI but it is another use of spreadsheets in this context. The benefits I have found include: * easy to create a new GUI using cut and paste from existing ones and to edit these when required; * simple to change things such as the options to pull down lists (in some circumstances you can users do this) * ability to have library routines to store and read back the contents of the GUI (I find this very useful since a number of the applications I provide are associated with design of products and therefore the saving of the GUI's contents represent a design file that can be used again and altered when necessary) * straightforward to add new widget types when necessary * a consistent way of accessing the contents of the GUI * ability to change the appearance of the GUI from data in a configuration file (this is read before the spreadsheet is processed) - in this way you can have one spreadsheet that is presented in a number of ways - this is useful when a number of users of the application each need to see something slightly different. * allows text in the GUI to be given in a number of languages (using the configuration file) I would be interested to know if anyone else has been using a spreadsheet in this way. Best regards Henry Merryweather