HomePage > Software Index > Development > gtkdialog > Tips and Tricks

1. Syntax

The very basics of building a simple gui is told by the links in gtkdialog documentation. You should have played a bit with some examples before you continue.

About QUOTES ( " and ' )
To show content of a variable in the gtkdialog code, we need to quote the variable correctly inside the gtkdialog code.

TEXT='Hello world'

export script='
<text>
 <label>Content of variable is: '"$TEXT"'</label>
</text>'

gtkdialog --program=script


Now in other words - Because this is important!!!

First realize that you put all the gtkdialog code into a variable - ie MyGui:
export MyGui="<window title=\"My title\"...........</window>"
if you now try to echo MyGui you'll get
<window title="My title"...........</window>
which is correct code. But if you use ' instead of ", like this:
export MyGui='<window title=\"My title\"...........</window>'
the value of MyGui is
<window title=\"My title\"...........</window>
This will give a syntax error, while
export MyGui='<window title="My title"...........</window>'
will give correct syntax.


Now using a variable inside the gtkdialog code like this:
TITLE="My title"
export MyGui="<window title=\"$TITLE\"...........</window>"
returns
<window title="My title"...........</window>
while
export MyGui='<window title="$TITLE"...........</window>'
returns
<window title="$TITLE"...........</window>
and not the content of variable TITLE


Now return to the first example about quotes. This example combines the use of ' and ".


Categories
CategoryGtkdialog
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki