Wiki source for gtkdialogDocTips1


Show raw source

[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]]

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

About QUOTES ( **{{color text=""" c="red"}}** and **{{color text="'" c="red"}}** )
To show content of a variable in the gtkdialog code, we need to quote the variable correctly inside the gtkdialog code.

%%(language-ref)
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""=**{{color text=""" c="red"}}**<window title=\"My title\"...........</window>**{{color text=""" c="red"}}**##
if you now try to ##echo ""MyGui""## you'll get
~##<window title="My title"...........</window>##
which is correct code. But if you use **{{color text="'" c="red"}}** instead of **{{color text=""" c="red"}}**, like this:
~##export ""MyGui""=**{{color text="'" c="red"}}**<window title=\"My title\"...........</window>**{{color text="'" c="red"}}**##
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""=**{{color text=""" c="red"}}**<window title=\"$TITLE\"...........</window>**{{color text=""" c="red"}}**##
returns
~##<window title="My title"...........</window>##
while
~##export ""MyGui""=**{{color text="'" c="red"}}**<window title="$TITLE"...........</window>**{{color text="'" c="red"}}**##
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 ".

===@@**#%[[gtkdialogDocTips|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips2|Next ❱❱❱]]#%**@@===
----
==Categories==
CategoryGtkdialog
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki