[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]] ====7. Advanced Syntax - make your code readable==== **Comments in your code** Gtkdialog doesn't support comments in its xml code. But if we convert all comments before execution, it works. The reason why I use double hash (""##"") for my comments, is because colors in a #### tag might be defined as ##red## or ###FF0000##. The latter would be removed by using a single hash. %%(language-ref) XML=' ##this is how to comment your xml code. ##force the text to take more space. ##hbox to align button to the right. ##button ok is fetched from the gtk stock. ' export GUI="`echo "$XML" | sed -e 's/##.*//'`" gtkdialog -p GUI %% **Include code if...** It is possible to build the gtkdialog out of many small pieces. Every piece is a variable and are put together when exporting the gtkdialog code. It is easy to think that a button should have different label depending on "//this or that//". Or like in the following example, - include a button if file/app/... exists. Instead of defining all these pieces before the actual gtkdialog code, it is much more human readable if you define all 'inside' the gtkdialog code. %%(language-ref) script=' ' [ -f /root/testfile ;then script=${script}'' script=${script}' ' export SCRIPT="$script" gtkdialog --program=SCRIPT %% ===@@**#%[[gtkdialogDocTips6.2|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips8|Next ❱❱❱]]#%**@@=== ---- ==Categories== CategoryGtkdialog