Gtkdialog Examples

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

Gtkdialog Examples

00.00-text

Example: File 00.00-text


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<text>
<label>This is a static text.</label>
</text>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

00.01-text_attributes

Example: File 00.01-text_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<text use-markup="true">
<label>"<b>use-markup</b>, which is cool."</label>
</text>
<text wrap="true" width-chars="10">

<label>wrap: wrap lines if the text becomes too wide, which is


also cool!</label>
</text>
<text selectable="true">
<label>selectable text, also cool</label>
</text>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

00.02-text_input

Example: File 00.02-text_input


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Label from file>
<text>
<label>This is a static text.</label>
<input file>/etc/hosts.allow</input>
</text>
</frame>
<frame Label from command>
<text>
<label>This is a static text.</label>
<input>date</input>
<variable>DATE</variable>
</text>
<hbox>
<button>
<label>refresh</label>
<action type="refresh">DATE</action>
</button>
</hbox>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

01.00-button

Example: File 01.00-button


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<button>
<label>Label</label>
<action>echo You pressed the button with the label.</action>

</button>
<button>
<input file>fileopen.xpm</input>
<action>echo You pressed the button with the pixmap.</action>
</button>
</hbox>
<hbox>
<button yes>
<action>echo You pressed the Yes button.</action>
</button>
<button no>
<action>echo You pressed the No button.</action>
</button>
</hbox>
<hbox>
<button ok>
<action>echo You pressed the OK button.</action>
</button>
<button cancel>
<action>echo You pressed the Cancel button.</action>
</button>
<button help>
<action>echo You pressed the Help button.</action>
</button>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

01.01-button_attributes

Example: File 01.01-button_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<button sensitive="false">
<label>Label</label>

<action>echo You pressed the button with the label.</action>


</button>
<button sensitive="false">
<input file>fileopen.xpm</input>
<action>echo You pressed the button with the pixmap.</action>
</button>
</hbox>
<hbox>
<button yes>
<action>echo You pressed the Yes button.</action>
</button>
<button no>
<action>echo You pressed the No button.</action>
</button>
</hbox>
<hbox>
<button ok>
<action>echo You pressed the OK button.</action>
</button>
<button cancel>
<action>echo You pressed the Cancel button.</action>
</button>
<button help>
<action>echo You pressed the Help button.</action>
</button>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

01.02-button_action_types

Example: File 01.02-button_action_types


#! /bin/bash
#
# Some action types are still missing. See execute_action() for more
# information.
#
export DIALOG='
<vbox>
<text>
<label>This is an other dialog window.</label>
</text>
<button>
<label>Close</label>
<action type="closewindow">DIALOG</action>
</button>
</vbox>
'
export MAIN_DIALOG='
<vbox>
<frame Widgets>
<checkbox>
<label>This is a checkbox</label>
<variable>CHECKBOX</variable>
</checkbox>
<entry>
<input>date</input>
<variable>ENTRY</variable>
</entry>
</frame>
<frame Button actions>
<hbox>
<button>
<label>exit</label>
<action>echo You pressed the exit button</action>
<action type="exit">Exit by button</action>
</button>
</hbox>
<hbox>
<button>
<label>launch</label>
<action type="launch">DIALOG</action>
</button>
<button>
<label>closewindow</label>
<action type="closewindow">DIALOG</action>
</button>
</hbox>
<hbox>
<button>
<label>enable</label>
<action type="enable">ENTRY</action>
<action type="enable">CHECKBOX</action>
</button>
<button>
<label>disable</label>
<action type="disable">ENTRY</action>
<action type="disable">CHECKBOX</action>
</button>

</hbox>
<hbox>
<button>
<label>refresh</label>
<action type="refresh">ENTRY</action>
</button>
<button>
<label>clear</label>
<action type="clear">ENTRY</action>
</button>
<button>
<label>fileselect</label>
<action type="fileselect">ENTRY</action>
</button>
</hbox>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

01.03-button_signals

Example: File 01.03-button_signals


#! /bin/bash
#
# Some action types are still missing. See execute_action() for more
# information.
#
export MAIN_DIALOG='
<vbox>
<frame Button signals>
<hbox>
<button>
<label>All Default</label>
</button>
<button>
<label>Enter/Leave/Clicked</label>
<action signal="clicked">echo Signal: clicked
/default/</action>
<action signal="enter">echo Signal: enter</action>
<action signal="leave">echo Signal: leave</action>
</button>

<button>
<label>Pressed/Released/Clicked</label>
<action signal="clicked">echo Signal: clicked
/default/</action>
<action signal="pressed">echo Signal: pressed</action>
<action signal="released">echo Signal: released</action>
</button>
</hbox>
</frame>
<hbox>
<button cancel>
<action signal="enter">echo Do you really want to exit?</action>
<action type="exit">Cancel</action>
</button>
<button ok>
<action signal="enter">echo Do you really want to exit?</action>
<action type="exit">OK</action>
</button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

01.04-button_icon_actions

Example: File 01.04-button_icon_actions


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<button>
<input file icon="about_kde"></input>
<action>echo about_kde</action>
</button>
<button>
<input file icon="attach"></input>
<action>echo attach</action>
</button>
<button>
<input file icon="back"></input>
<action>echo back</action>
</button>
<button>
<input file icon="bookmark_add"></input>

<action>echo bookmark_add</action>
</button>
<button>
<input file icon="bookmark"></input>
<action>echo bookmark</action>
</button>
<button>
<input file icon="bottom"></input>
<action>echo bottom</action>
</button>
<button>
<input file icon="button_cancel"></input>
<action>echo button_cancel</action>
</button>
<button>
<input file icon="button_ok"></input>
<action>echo button_ok</action>
</button>
<button>
<input file icon="cd"></input>
<action>echo cd</action>
</button>
<button>
<input file icon="colorpicker"></input>
<action>echo colorpicker</action>
</button>
<button>
<input file icon="configure"></input>
<action>echo configure</action>
</button>
<button>
<input file icon="configure_shortcuts"></input>
<action>echo configure_shortcuts</action>
</button>
<button>
<input file icon="configure_toolbars"></input>
<action>echo configure_toolbars</action>
</button>
<button>
<input file icon="connect_established"></input>
<action>echo connect_established</action>
</button>
<button>
<input file icon="connect_no"></input>
<action>echo connect_no</action>
</button>
<button>
<input file icon="contents2"></input>
<action>echo contents2</action>
</button>
<button>
<input file icon="contents"></input>
<action>echo contents</action>
</button>
<button>
<input file icon="down"></input>
<action>echo down</action>
</button>
<button>
<input file icon="edit_add"></input>
<action>echo edit_add</action>

</button>
<button>
<input file icon="editcopy"></input>
<action>echo editcopy</action>
</button>
<button>
<input file icon="editcut"></input>
<action>echo editcut</action>
</button>
<button>
<input file icon="editdelete"></input>
<action>echo editdelete</action>
</button>
<button>
<input file icon="editpaste"></input>
<action>echo editpaste</action>
</button>
<button>
<input file icon="edit"></input>
<action>echo edit</action>
</button>
</hbox>
<hbox>
<button>
<input file icon="edit_remove"></input>
<action>echo edit_remove</action>
</button>
<button>
<input file icon="edittrash"></input>
<action>echo edittrash</action>
</button>
<button>
<input file icon="exec"></input>
<action>echo exec</action>
</button>
<button>
<input file icon="exit"></input>
<action>echo exit</action>
</button>
<button>
<input file icon="fileexport"></input>
<action>echo fileexport</action>
</button>
<button>
<input file icon="filefind"></input>
<action>echo filefind</action>
</button>
<button>
<input file icon="fileimport"></input>
<action>echo fileimport</action>
</button>
<button>
<input file icon="filenew"></input>
<action>echo filenew</action>
</button>
<button>
<input file icon="fileopen"></input>
<action>echo fileopen</action>
</button>
<button>
<input file icon="fileprint"></input>

<action>echo fileprint</action>
</button>
<button>
<input file icon="filequickprint"></input>
<action>echo filequickprint</action>
</button>
<button>
<input file icon="filesaveas"></input>
<action>echo filesaveas</action>
</button>
<button>
<input file icon="filesave"></input>
<action>echo filesave</action>
</button>
<button>
<input file icon="finish"></input>
<action>echo finish</action>
</button>
<button>
<input file icon="forward"></input>
<action>echo forward</action>
</button>
<button>
<input file icon="frameprint"></input>
<action>echo frameprint</action>
</button>
<button>
<input file icon="gohome"></input>
<action>echo gohome</action>
</button>
<button>
<input file icon="goto"></input>
<action>echo goto</action>
</button>
<button>
<input file icon="help"></input>
<action>echo help</action>
</button>
<button>
<input file icon="history"></input>
<action>echo history</action>
</button>
<button>
<input file icon="khtml_kget"></input>
<action>echo khtml_kget</action>
</button>
<button>
<input file icon="locationbar_erase"></input>
<action>echo locationbar_erase</action>
</button>
<button>
<input file icon="lock"></input>
<action>echo lock</action>
</button>
<button>
<input file icon="player-eject"></input>
<action>echo player-eject</action>
</button>
</hbox>
<hbox>
<button>

<input file icon="player_end"></input>


<action>echo player_end</action>
</button>
<button>
<input file icon="player-fwd"></input>
<action>echo player-fwd</action>
</button>
<button>
<input file icon="player_pause"></input>
<action>echo player_pause</action>
</button>
<button>
<input file icon="player_play"></input>
<action>echo player_play</action>
</button>
<button>
<input file icon="player_rew"></input>
<action>echo player_rew</action>
</button>
<button>
<input file icon="player_start"></input>
<action>echo player_start</action>
</button>
<button>
<input file icon="player_stop"></input>
<action>echo player_stop</action>
</button>
<button>
<input file icon="redo"></input>
<action>echo redo</action>
</button>
<button>
<input file icon="reload"></input>
<action>echo reload</action>
</button>
<button>
<input file icon="run"></input>
<action>echo run</action>
</button>
<button>
<input file icon="spellcheck"></input>
<action>echo spellcheck</action>
</button>
<button>
<input file icon="start"></input>
<action>echo start</action>
</button>
<button>
<input file icon="stop"></input>
<action>echo stop</action>
</button>
<button>
<input file icon="text_block"></input>
<action>echo text_block</action>
</button>
<button>
<input file icon="text_bold"></input>
<action>echo text_bold</action>
</button>
<button>
<input file icon="text_center"></input>

<action>echo text_center</action>
</button>
<button>
<input file icon="text_italic"></input>
<action>echo text_italic</action>
</button>
<button>
<input file icon="text-left"></input>
<action>echo text-left</action>
</button>
<button>
<input file icon="text_right"></input>
<action>echo text_right</action>
</button>
<button>
<input file icon="text_strike"></input>
<action>echo text_strike</action>
</button>
<button>
<input file icon="text_under"></input>
<action>echo text_under</action>
</button>
<button>
<input file icon="top"></input>
<action>echo top</action>
</button>
<button>
<input file icon="undo"></input>
<action>echo undo</action>
</button>
<button>
<input file icon="up"></input>
<action>echo up</action>
</button>
</hbox>
<hbox>
<button>
<input file icon="viewmag1"></input>
<action>echo viewmag1</action>
</button>
<button>
<input file icon="viewmagfit"></input>
<action>echo viewmagfit</action>
</button>
<button>
<input file icon="viewmag-"></input>
<action>echo viewmag-</action>
</button>
<button>
<input file icon="viewmag+"></input>
<action>echo viewmag+</action>
</button>
<button>
<input file icon="window_fullscreen"></input>
<action>echo window_fullscreen</action>
</button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

02.00-entry

Example: File 02.00-entry


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<entry>
<default>Default value</default>
<variable>ENTRY</variable>
</entry>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

02.01-entry_attributes

Example: File 02.01-entry_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<text>
<label>activates_default:</label>

</text>
<entry activates_default="true">
<default>Default value</default>
<variable>ENTRY1</variable>
</entry>
</hbox>
<hbox>
<text>
<label>editable:</label>
</text>
<entry editable="false">
<default>Default value</default>
<variable>ENTRY2</variable>
</entry>
</hbox>
<hbox>
<text>
<label>has_frame:</label>
</text>
<entry has_frame="false">
<default>Default value</default>
<variable>ENTRY3</variable>
</entry>
</hbox>
<hbox>
<text>
<label>invisible_char:</label>
</text>
<entry invisible_char="x" visibility="false">
<default>Default value</default>
<variable>ENTRY4</variable>
</entry>
</hbox>
<hbox>
<text>
<label>max_length:</label>
</text>
<entry max_length="5">
<default>Default value</default>
<variable>ENTRY5</variable>
</entry>
</hbox>
<hbox>
<text>
<label>width_chars:</label>
</text>
<entry width_chars="35">
<default>Default value</default>
<variable>ENTRY6</variable>
</entry>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>

</vbox>
'
gtkdialog --program=MAIN_DIALOG

02.02-entry_input

Example: File 02.02-entry_input


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<entry>
<input>whoami</input>
<variable>ENTRY</variable>
</entry>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

03.00-checkbox

Example: File 03.00-checkbox


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Checkbox example>
<checkbox>
<label>This is a checkbox...</label>
<variable>CHECKBOX</variable>

<action>echo Checkbox is $CHECKBOX now.</action>


<action>if true enable:ENTRY</action>
<action>if false disable:ENTRY</action>
</checkbox>
<entry>
<default>Text in the entry</default>
<variable>ENTRY</variable>
<visible>disabled</visible>
</entry>
<checkbox>
<label>I want an OK button NOW!</label>
<default>true</default>
<variable>ANOTHER_CHECKBOX</variable>
<action>if true enable:OKBUTTON</action>
<action>if false disable:OKBUTTON</action>
</checkbox>
</frame>
<hbox>
<button ok>
<variable>OKBUTTON</variable>
</button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

03.01-checkbox_attributes

Example: File 03.01-checkbox_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Checkbox attributes example>
<checkbox active="true">
<label>Checkbox with active set to true</label>
<variable>CHECKBOX1</variable>
<action>echo Checkbox is $CHECKBOX1 now.</action>
</checkbox>
<checkbox draw_indicator="false">
<label>Checkbox with draw_indicator set to false</label>
<variable>CHECKBOX2</variable>
<action>echo Checkbox is $CHECKBOX2 now.</action>
</checkbox>

<checkbox inconsistent="true">
<label>Checkbox with inconsistent set to true</label>
<variable>CHECKBOX3</variable>
<action>echo Checkbox is $CHECKBOX3 now.</action>
</checkbox>
</frame>
<hbox>
<button ok>
<variable>OKBUTTON</variable>
</button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

04.01-radiobutton_attributes

Example: File 04.01-radiobutton_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Radiobutton attributes example>
<radiobutton active="true">
<label>Radiobutton with active set to true</label>
<variable>RADIOBUTTON1</variable>
<action>echo Radiobutton is $RADIOBUTTON1 now.</action>
</radiobutton>
<radiobutton draw_indicator="false">
<label>Radiobutton with draw_indicator set to false</label>
<variable>RADIOBUTTON2</variable>
<action>echo Radiobutton is $RADIOBUTTON2 now.</action>
</radiobutton>
<radiobutton inconsistent="true">
<label>Radiobutton with inconsistent set to true</label>
<variable>RADIOBUTTON3</variable>
<action>echo Radiobutton is $RADIOBUTTON3 now.</action>
</radiobutton>
</frame>
<hbox>
<button ok>
<variable>OKBUTTON</variable>

</button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

05.00-combo

Example: File 05.00-combo


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<text>
<label>Combobox:</label>
</text>
<combobox>
<variable>COMBOBOX</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
</combobox>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

05.00-progress_bar

Example: File 05.00-progress_bar

#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Progress>
<text>
<label>Some text describing what is happening.</label>
</text>
<progressbar>
<label>Some Text</label>
<input>for i in $(seq 0 10 100); do echo $i; sleep 0.3;
done</input>
<action type="exit">Ready</action>
</progressbar>
</frame>
<hbox>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

05.01-combo_attributes

Example: File 05.01-combo_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<text>
<label>value-in-list:</label>
</text>
<combobox case-sensitive="false" value-in-list="true">
<variable>COMBOBOX1</variable>
<item>First</item>
<item>Second</item>
<item>Third</item>
</combobox>
</hbox>
<hbox>
<text>
<label>allow-empty:</label>
</text>
<combobox allow-empty="false" value-in-list="true">
<variable>COMBOBOX2</variable>
<item>First</item>
<item>Second</item>

<item>Third</item>
</combobox>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

05.01-progress_bar_closewindow

Example: File 05.01-progress_bar_closewindow


#! /usr/bin/gtkdialog -e
function progress() {
for i in $(seq 0 10 100); do
echo $i
[ "$i" -le 30 ] && echo "Start..."
[ "$i" -le 60 -a "$i" -gt 30 ] && echo "Middle..."
[ "$i" -gt 60 ] && echo "End..."
sleep 0.3
done;
echo ready
}
export MAIN_DIALOG='
<hbox>
<button cancel> </button>
<button>
<label>Launch</label>
<action type="launch">BAR_DIALOG</action>
</button>
</hbox>
'
export BAR_DIALOG='
<vbox>
<frame Progress>
<text>
<label>Some text describing what is happening.</label>
</text>
<progressbar>
<label>Some Text</label>
<input>progress</input>
<action type="closewindow">Ready</action>
</progressbar>
</frame>
<hbox>

<button cancel>
<action type="closewindow">BAR_DIALOG</action>
</button>
</hbox>
</vbox>
'

05.02-combo_input

Example: File 05.02-combo_input


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<text>
<label>Combobox:</label>
</text>
<combobox>
<variable>COMBOBOX</variable>
<input>ls</input>
</combobox>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

05.02-progress_bar_test

Example: File 05.02-progress_bar_test


#! /usr/bin/gtkdialog -e
function progress() {
for i in $(seq 0 10 100); do
echo $i

[ "$i" -le 30 ] && echo "Start..."


[ "$i" -le 60 -a "$i" -gt 30 ] && echo "Middle..."
[ "$i" -gt 60 ] && echo "End..."
sleep 0.3
done;
echo ready
}
function progress_fast() {
for i in $(seq 0 1 10000); do
echo $((i/100))
[ "$i" -le 3000 ] && echo "Start..."
[ "$i" -le 6000 -a "$i" -gt 3000 ] && echo "Middle..."
[ "$i" -gt 6000 ] && echo "End..."
#sleep 0.1
done;
echo ready
}
export MAIN_DIALOG='
<vbox>
<entry>
<variable>ENTRY</variable>
<input>date</input>
</entry>
<hbox>
<button cancel> </button>
<button>
<label>Launch</label>
<action type="launch">BAR_DIALOG</action>
</button>
<button>
<label>Close</label>
<action type="exit">CLOSE</action>
</button>
</hbox>
</vbox>
'
export BAR_DIALOG='
<vbox>
<frame Progress>
<text>
<label>Some text describing what is happening.</label>
</text>
<progressbar>
<variable>PROGRESS_BAR</variable>
<label>Some Text</label>
<input>progress_fast</input>
<action type="refresh">ENTRY</action>
<action type="closewindow">BAR_DIALOG</action>
<action>echo ready</action>
</progressbar>
</frame>
<hbox>
<button cancel>
<action type="closewindow">BAR_DIALOG</action>
</button>

</hbox>
</vbox>
'

06.00-editor

Example: File 06.00-editor


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<edit>
<variable>EDITOR</variable>
<width>350</width><height>150</height>
<default>
"This is the default text of the editor."
</default>
</edit>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

06.00-pixmap

Example: File 06.00-pixmap


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Pixmap from Stock>
<pixmap icon_size="6">
<input file stock="gtk-info"></input>
</pixmap>
</frame>
<frame Pixmap from File>
<pixmap>
<input file>gvim.png</input>
</pixmap>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

06.01-editor_attributes

Example: File 06.01-editor_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<edit editable="false">
<variable>EDITOR2</variable>
<width>350</width><height>50</height>
<default>editable is false</default>
</edit>

<edit accepts-tab="false">
<variable>EDITOR1</variable>
<width>350</width><height>50</height>
<default>accepts-tab is false</default>
</edit>
<edit indent="25">
<variable>EDITOR2</variable>
<width>350</width><height>50</height>
<default>indent is 25</default>
</edit>
<edit left-margin="25" right-margin="25">
<variable>EDITOR2</variable>
<width>350</width><height>50</height>
<default>left-margin and right-margin is 25</default>
</edit>
<edit cursor-visible="false">
<variable>EDITOR2</variable>
<width>350</width><height>50</height>
<default>cursor-visible is false</default>
</edit>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

07.00-list

Example: File 07.00-list


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<list>
<variable>LIST</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
</list>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>

'
gtkdialog --program=MAIN_DIALOG

07.01-list_attributes

Example: File 07.01-list_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<list selection-mode="3">
<variable>LIST</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
</list>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

07.02-list_actions

Example: File 07.02-list_actions


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<list>
<variable>LIST</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
<action>echo Chosen item is $LIST</action>
</list>

<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

08.00-table

Example: File 08.00-table


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<table>
<width>500</width><height>200</height>
<variable>TABLE</variable>
<label>Header of Column 1|Header of Column 2|Header of Column
3</label>
<item>First item |Row 1 Column 2 |Row 1 Column 3</item>
<item>Second item|Row 2 Column 2 |Row 2 Column 3</item>
<item>Third item |Row 3 Column 2 |Row 3 Column 3</item>
<action>echo $TABLE</action>
</table>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

09.00-tree

Example: File 09.00-tree


#! /bin/bash
#
# stock_column
# icon_column
#
export MAIN_DIALOG='
<vbox>
<tree stock="gtk-file">
<label>Permissions|Filename</label>
<input>./list.sh</input>
<height>100</height><width>400</width>
<variable>TREE1</variable>
</tree>
<tree stock="gtk-file">
<label>Permissions|Filename</label>
<input icon_column="0">./list.sh</input>
<height>100</height><width>400</width>
<variable>TREE1</variable>
</tree>
<tree>
<label>Device
| Directory
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-cdrom">CD_ROM Drive | /cdrom/
<height>100</height><width>400</width>
<variable>TREE2</variable>
</tree>
<hbox>
<button cancel></button>
<button ok></button>

|
|
|
|
|
|

File</label>
ak.tex</item>
ak.dvi</item>
ak.ps</item>
ak.pdf</item>
</item>

</hbox>
</vbox>
'
GTKDIALOG=gtkdialog
if [ -x "$HOME/bin/gtkdialog" ]; then
GTKDIALOG="$HOME/bin/gtkdialog"
fi
$GTKDIALOG --program=MAIN_DIALOG

09.01-tree_attributes

Example: File 09.01-tree_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame With Rules, Without Headers>
<tree rules_hint="true" headers_visible="false">
<input file>tmp.text</input>
<label>Device
| Directory
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-cdrom">CD_ROM Drive | /cdrom/
<height>100</height><width>400</width>
<variable>TREE</variable>
</tree>
</frame>
<frame Hover Mode>
<tree hover_expand="true" hover_selection="true">
<input file>tmp.text</input>
<label>Device
| Directory
<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-floppy">Floppy Disk | /floppy/

|
|
|
|
|
|

File</label>
ak.tex</item>
ak.dvi</item>
ak.ps</item>
ak.pdf</item>
</item>

| File</label>
| ak.tex</item>
| ak.dvi</item>

<item stock="gtk-floppy">Floppy Disk | /floppy/


<item stock="gtk-floppy">Floppy Disk | /floppy/
<item stock="gtk-cdrom">CD_ROM Drive | /cdrom/
<height>100</height><width>400</width>
<variable>TREE</variable>
</tree>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'

| ak.ps</item>
| ak.pdf</item>
| </item>

gtkdialog --program=MAIN_DIALOG

09.01-tree_items

Example: File 09.01-tree_items


#! /bin/bash
#
# The <item> tag can hold the following attributes:
#
o stock or stock_id
#
o icon or icon_name
#
export MAIN_DIALOG='
<vbox>
<tree>
<input file>tmp.text</input>
<label>Device
| Directory | File</label>
<item stock_id="gtk-floppy">Floppy Disk | /floppy/ |
ak.tex</item>
<item stock="gtk-floppy">Floppy Disk | /floppy/ | ak.dvi</item>
<item icon="pdf">Floppy Disk | /floppy/ | ak.ps</item>
<item icon_name="rpm">Floppy Disk | /floppy/ | ak.pdf</item>
<item stock="gtk-cdrom">CD_ROM Drive | /cdrom/
| </item>
<height>100</height><width>400</width>
<variable>TREE2</variable>
</tree>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'

GTKDIALOG=gtkdialog
if [ -x "$HOME/bin/gtkdialog" ]; then
GTKDIALOG="$HOME/bin/gtkdialog"
fi
$GTKDIALOG --program=MAIN_DIALOG

09.02-tree_actions

Example: File 09.02-tree_actions


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Tree With Actions>
<text>
<label>
"The column 0 is the stoc icon name. However the exported column is
the
1st column, so you see the first text column printed to the standard
output."
</label>
</text>
<tree rules_hint="true" exported_column="1">
<label>One
| Two
| Three </label>
<item stock="gtk-yes">r1c1|r1c2|r1c3</item>
<item stock="gtk-no">r2c1|r2c2|r2c3</item>
<item stock="gtk-no">r3c1|r3c2|r3c3</item>
<variable>TREE</variable>
<height>100</height><width>200</width>
<action>echo action[Double Click]: $TREE</action>

<action signal="button-press-event">echo button-pressevent[BUTTON=$BUTTON]: $TREE</action>


<action signal="button-release-event">echo button-releaseevent[BUTTON=$BUTTON]: $TREE</action>
<action signal="cursor_changed">echo cursor_changed:
$TREE</action>
</tree>
</frame>
<frame Another Tree With Actions>
<tree rules_hint="true">
<label>One
| Two
| Three </label>
<item>r1c1|r1c2|r1c3</item>
<item>r2c1|r2c2|r2c3</item>
<item>r3c1|r3c2|r3c3</item>
<variable>OTHERTREE</variable>
<height>100</height><width>200</width>
<action>echo action[Double Click]: $OTHERTREE</action>
<action signal="button-press-event">echo button-pressevent[BUTTON=$BUTTON]: $TREE</action>
<action signal="button-release-event">echo button-releaseevent[BUTTON=$BUTTON]: $TREE</action>
<action signal="cursor_changed">echo cursor_changed:
$OTHERTREE</action>
</tree>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

09.02-tree_default_pixmaps

Example: File 09.02-tree_default_pixmaps


#! /bin/bash
#

# The <tree> tag can hold the following attributes for using as a
default icon:
#
o stock or stock_id
#
o icon or icon_name
#
export MAIN_DIALOG='
<vbox>
<tree stock="gtk-apply">
<input file>tmp.text</input>
<label>Device
| Directory | File</label>
<item>Floppy Disk | /floppy/ | ak.tex</item>
<item>Floppy Disk | /floppy/ | ak.dvi</item>
<item icon="pdf">Floppy Disk | /floppy/ | ak.ps</item>
<item icon_name="rpm">Floppy Disk | /floppy/ | ak.pdf</item>
<item stock="gtk-cdrom">CD_ROM Drive | /cdrom/
| </item>
<height>100</height><width>400</width>
<variable>TREE2</variable>
</tree>
<tree icon_name="file-devel-cpp">
<input file>tmp.text</input>
<label>Device
| Directory | File</label>
<item>Floppy Disk | /floppy/ | ak.tex</item>
<item>Floppy Disk | /floppy/ | ak.dvi</item>
<item icon="pdf">Floppy Disk | /floppy/ | ak.ps</item>
<item icon_name="rpm">Floppy Disk | /floppy/ | ak.pdf</item>
<item stock="gtk-cdrom">CD_ROM Drive | /cdrom/
| </item>
<height>100</height><width>400</width>
<variable>TREE2</variable>
</tree>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
GTKDIALOG=gtkdialog
if [ -x "$HOME/bin/gtkdialog" ]; then
GTKDIALOG="$HOME/bin/gtkdialog"
fi
$GTKDIALOG --program=MAIN_DIALOG

09.03-tree_icon_columns

Example: File 09.03-tree_icon_columns


#! /bin/bash
#
# The <input> tags can have attributes setting which input column
holds the
# icon information:
#
o stock_column
#
o icon_column
#
export MAIN_DIALOG='
<vbox>
<tree>
<label>Stock name | Permissions|Filename</label>
<input>./list.sh</input>
<height>200</height><width>600</width>
<variable>TREE1</variable>
</tree>
<tree stock="gtk-file">
<label>Permissions|Filename</label>
<input icon_column="0">./list.sh</input>
<height>200</height><width>600</width>
<variable>TREE2</variable>
</tree>
<hbox>
<button cancel></button>
<button ok></button>

</hbox>
</vbox>
'
GTKDIALOG=gtkdialog
if [ -x "$HOME/bin/gtkdialog" ]; then
GTKDIALOG="$HOME/bin/gtkdialog"
fi
$GTKDIALOG --program=MAIN_DIALOG

09.09-tree_insert

Example: File 09.09-tree_insert


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Insert and Remove>
<tree rules_hint="true" headers_visible="false">
<height>100</height><width>400</width>
<variable>TREE</variable>
</tree>
<hbox>
<entry>
<variable>ENTRY</variable>
</entry>
<button>
<input file stock="gtk-add"></input>
<action type="insert">ENTRY,TREE</action>
</button>
<button>
<input file stock="gtk-remove"></input>
<action type="removeselected">TREE</action>
</button>
</hbox>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

09.10-tree_icon_stocks

Example: File 09.10-tree_icon_stocks


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Stock>
<tree rules_hint="true" exported_column="1">
<height>400</height><width>250</width>
<label>Stock ID</label>
<item stock="gtk-dialog-authentication">gtk-dialogauthentication</item>
<item stock="gtk-dialog-info">gtk-dialog-info</item>
<item stock="gtk-dialog-warning">gtk-dialog-warning</item>
<item stock="gtk-dialog-error">gtk-dialog-error</item>
<item stock="gtk-dialog-question">gtk-dialog-question</item>
<item stock="gtk-dnd">gtk-dnd</item>
<item stock="gtk-dnd-multiple">gtk-dnd-multiple</item>
<item stock="gtk-about">gtk-about</item>
<item stock="gtk-add">gtk-add</item>
<item stock="gtk-apply">gtk-apply</item>
<item stock="gtk-bold">gtk-bold</item>
<item stock="gtk-cancel">gtk-cancel</item>
<item stock="gtk-cdrom">gtk-cdrom</item>
<item stock="gtk-clear">gtk-clear</item>
<item stock="gtk-close">gtk-close</item>
<item stock="gtk-color-picker">gtk-color-picker</item>
<item stock="gtk-convert">gtk-convert</item>

<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item
<item

stock="gtk-connect">gtk-connect</item>
stock="gtk-copy">gtk-copy</item>
stock="gtk-cut">gtk-cut</item>
stock="gtk-delete">gtk-delete</item>
stock="gtk-directory">gtk-directory</item>
stock="gtk-disconnect">gtk-disconnect</item>
stock="gtk-edit">gtk-edit</item>
stock="gtk-execute">gtk-execute</item>
stock="gtk-file">gtk-file</item>
stock="gtk-find">gtk-find</item>
stock="gtk-find-and-replace">gtk-find-and-replace</item>
stock="gtk-floppy">gtk-floppy</item>
stock="gtk-fullscreen">gtk-fullscreen</item>
stock="gtk-goto-bottom">gtk-goto-bottom</item>
stock="gtk-goto-first">gtk-goto-first</item>
stock="gtk-goto-last">gtk-goto-last</item>
stock="gtk-goto-top">gtk-goto-top</item>
stock="gtk-go-back">gtk-go-back</item>
stock="gtk-go-down">gtk-go-down</item>
stock="gtk-go-forward">gtk-go-forward</item>
stock="gtk-go-up">gtk-go-up</item>
stock="gtk-harddisk">gtk-harddisk</item>
stock="gtk-help">gtk-help</item>
stock="gtk-home">gtk-home</item>
stock="gtk-index">gtk-index</item>
stock="gtk-indent">gtk-indent</item>
stock="gtk-info">gtk-info</item>
stock="gtk-unindent">gtk-unindent</item>
stock="gtk-italic">gtk-italic</item>
stock="gtk-jump-to">gtk-jump-to</item>
stock="gtk-justify-center">gtk-justify-center</item>
stock="gtk-justify-fill">gtk-justify-fill</item>
stock="gtk-justify-left">gtk-justify-left</item>
stock="gtk-justify-right">gtk-justify-right</item>
stock="gtk-leave-fullscreen">gtk-leave-fullscreen</item>
stock="gtk-missing-image">gtk-missing-image</item>
stock="gtk-media-forward">gtk-media-forward</item>
stock="gtk-media-next">gtk-media-next</item>
stock="gtk-media-pause">gtk-media-pause</item>
stock="gtk-media-play">gtk-media-play</item>
stock="gtk-media-previous">gtk-media-previous</item>
stock="gtk-media-record">gtk-media-record</item>
stock="gtk-media-rewind">gtk-media-rewind</item>
stock="gtk-media-stop">gtk-media-stop</item>
stock="gtk-network">gtk-network</item>
stock="gtk-new">gtk-new</item>
stock="gtk-no">gtk-no</item>
stock="gtk-ok">gtk-ok</item>
stock="gtk-open">gtk-open</item>
stock="gtk-paste">gtk-paste</item>
stock="gtk-preferences">gtk-preferences</item>
stock="gtk-print">gtk-print</item>
stock="gtk-print-preview">gtk-print-preview</item>
stock="gtk-properties">gtk-properties</item>
stock="gtk-quit">gtk-quit</item>
stock="gtk-redo">gtk-redo</item>
stock="gtk-refresh">gtk-refresh</item>
stock="gtk-remove">gtk-remove</item>
stock="gtk-revert-to-saved">gtk-revert-to-saved</item>
stock="gtk-save">gtk-save</item>
stock="gtk-save-as">gtk-save-as</item>

<item stock="gtk-select-color">gtk-select-color</item>
<item stock="gtk-select-font">gtk-select-font</item>
<item stock="gtk-sort-ascending">gtk-sort-ascending</item>
<item stock="gtk-sort-descending">gtk-sort-descending</item>
<item stock="gtk-spell-check">gtk-spell-check</item>
<item stock="gtk-stop">gtk-stop</item>
<item stock="gtk-strikethrough">gtk-strikethrough</item>
<item stock="gtk-undelete">gtk-undelete</item>
<item stock="gtk-underline">gtk-underline</item>
<item stock="gtk-undo">gtk-undo</item>
<item stock="gtk-yes">gtk-yes</item>
<item stock="gtk-zoom-100">gtk-zoom-100</item>
<item stock="gtk-zoom-fit">gtk-zoom-fit</item>
<item stock="gtk-zoom-in">gtk-zoom-in</item>
<item stock="gtk-zoom-out">gtk-zoom-out</item>
</tree>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

09.11-tree_icon_names

Example: File 09.11-tree_icon_names


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Icon name examples>
<tree rules_hint="true" exported_column="1">
<height>400</height><width>550</width>
<label>Icon Names</label>
<item icon="gnome-mime-applicationencapsulatedpostscript">gnome-mime-applicationencapsulatedpostscript</item>
<item icon="i-floppy">i-floppy</item>
<item icon="image2">image2</item>
<item icon="image3">image3</item>
<item icon="image">image</item>
<item icon="info">info</item>
<item icon="install">install</item>
<item icon="log">log</item>
<item icon="make">make</item>
<item icon="man">man</item>
<item icon="metafont">metafont</item>
<item icon="midi">midi</item>
<item icon="mime_ascii">mime_ascii</item>
<item icon="mime_empty">mime_empty</item>
<item icon="misc_doc">misc_doc</item>
</tree>

</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

09.12-tree_one_column

Example: File 09.12-tree_one_column


#! /usr/bin/gtkdialog -e
function list() {
ls -lha | grep ^d | awk '{print "stock_folder|" $9}'
ls -lha | grep ^- | awk '{print "file-executable|" $9}'
}
export MAIN_DIALOG='
<vbox>
<frame Icon name examples>
<tree rules_hint="true" exported_column="0">
<height>200</height><width>400</width>
<label>Files</label>
<input icon_column="0">list</input>
<variable>TREE</variable>
</tree>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'

10.00-vbox_and_hbox

Example: File 10.00-vbox_and_hbox


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<text><label>Label1</label></text>
<entry></entry>
</hbox>
<hbox>
<text><label>Label2</label></text>
<entry></entry>
</hbox>
<hbox>
<button cancel></button>
<button help></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

10.01-vbox_and_hbox_attributes

Example: File 10.01-vbox_and_hbox_attributes


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Space>
<hbox spacing="10">
<text><label>spacing</label></text>
<entry></entry>
</hbox>
<hbox homogeneous="true">
<text><label>homogeneous</label></text>
<entry></entry>
</hbox>
</frame>
<frame Description>
<hbox>
<pixmap>
<input file stock="gtk-info"></input>
</pixmap>
<text>
<label>
"This is a label with a rather long text, so it must be wrapped as the
user
resizes the window. However, the default label width is 30
characters."
</label>
</text>
</hbox>
</frame>
<frame Description>
<hbox fill="true" expand="true">
<pixmap>
<input file stock="gtk-info"></input>

</pixmap>
<text>
<label>
"This is a label with a rather long text, so it must be wrapped as the
user
resizes the window. However, the default label width is 30
characters."
</label>
</text>
</hbox>
</frame>
<hbox>
<button cancel></button>
<button help></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

11.00-frame

Example: File 11.00-frame


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Frame1>
<text><label>Label1</label></text>
<entry></entry>
</frame>
<frame Frame2>
<hbox>
<text><label>Label2</label></text>
<entry></entry>
</hbox>
</frame>
<hbox>
<button cancel></button>
<button help></button>
</hbox>
</vbox>
'

gtkdialog --program=MAIN_DIALOG

12.00-notebook

Example: File 12.00-notebook


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<notebook labels="Checkbox|Radiobutton|Tree">
<vbox>
<checkbox>
<label>This is a checkbox</label>
</checkbox>
<checkbox>
<label>Another checkbox</label>
</checkbox>
<checkbox>
<label>The third checkbox</label>
</checkbox>
</vbox>
<vbox>
<radiobutton>
<label>First radiobutton in the group</label>
</radiobutton>
<radiobutton>
<label>The second radiobutton</label>
</radiobutton>
<radiobutton>
<label>Third radiobutton</label>
<default>true</default>
</radiobutton>
</vbox>
<tree>
<input file>tmp.text</input>
<label>First</label>
<item stock="gtk-floppy">This is a floppy</item>
<item stock="gtk-cdrom">This is a CD-ROM</item>
<item>This line has no icon</item>
<variable>EDITOR</variable>
</tree>
</notebook>
<hbox>

<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

13.00-chooser

Example: File 13.00-chooser


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<chooser>
<height>500</height><width>600</width>
<variable>CHOOSER</variable>
</chooser>
<hbox>
<button help></button>

<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

14.00-menubar

Example: File 14.00-menubar


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<menubar>
<menu>
<menuitem stock="gtk-open">
<action>echo You selected the open menu item.</action>
</menuitem>
<menuitem stock="gtk-save">
<action>echo You selected the open menu item.</action>
</menuitem>
<separator></separator>
<menuitem stock="gtk-quit">
<action>echo You selected the quit menu item</action>
<action type="exit">exit by menu</action>
</menuitem>
<label>File</label>
</menu>
<menu>
<menuitem stock="gtk-copy">
<action>echo You selected the copy menuitem.</action>
</menuitem>
<menuitem stock="gtk-cut">
<action>echo You selected the cut menuitem.</action>
</menuitem>
<menuitem stock="gtk-paste">
<action>echo You selected the paste menuitem.</action>
</menuitem>
<label>Edit</label>
</menu>
<menu>
<menuitem>
<label>A menu item</label>
<action>echo You selected the custom menu item.</action>
</menuitem>
<label>Item</label>
</menu>
</menubar>
<hbox>
<button cancel></button>
<button ok></button>

</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

14.01-menubar_icons

Example: File 14.01-menubar_icons


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<menubar>
<menu>
<menuitem stock="gtk-open">
<action>echo You selected the open menu item.</action>
</menuitem>
<menuitem stock="gtk-save">
<action>echo You selected the save menu item.</action>
</menuitem>
<separator></separator>
<menuitem stock="gtk-quit">
<action>echo You selected the quit menu item</action>
<action type="exit">exit by menu</action>
</menuitem>
<label>Stock</label>
</menu>
<menu>
<menuitem icon="gtk-floppy">
<label>This is a floppy</label>
<action>echo You selected the floppy menuitem.</action>
</menuitem>
<menuitem icon="gtk-cdrom">
<label>This is a CD-ROM</label>
<action>echo You selected the CD-ROM menuitem.</action>
</menuitem>
<label>Icon</label>
</menu>
<menu>
<menuitem>
<label>This is a text</label>
<action>echo You selected the text item.</action>
</menuitem>
<label>Label</label>
</menu>
</menubar>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>

'
gtkdialog --program=MAIN_DIALOG

15.00-window

Example: File 15.00-window


#! /bin/bash
export MAIN_DIALOG='
<window>
<vbox>
<frame DEscription>
<text>
<label>This is an example window.</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=MAIN_DIALOG

15.01.window_attributes

Example: File 15.01.window_attributes


#! /bin/bash
export DIALOG='
<window title="Example Window" icon-name="gtk-dialog-warning">
<vbox>
<frame Description>
<text>
<label>icon-name="gtk-dialog-warning"</label>
</text>
</frame>

<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG
export DIALOG='
<window title="Example Window" decorated="false">
<vbox>
<frame Description>
<text>
<label>decorated=false</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG
export DIALOG='
<window title="Example Window" resizable="false">
<vbox>
<frame Description>
<text>
<label>resizable=false</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG
export DIALOG='
<window title="Example Window" window_position="1">
<vbox>
<frame Description>
<text>
<label>window_position=1 (GTK_WIN_POS_CENTER)</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG
export DIALOG='

<window title="Example Window" window_position="2">


<vbox>
<frame Description>
<text>
<label>window_position=2 (GTK_WIN_POS_MOUSE)</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG
export DIALOG='
<window title="Example Window" skip_taskbar_hint="true">
<vbox>
<frame Description>
<text>
<label>skip_taskbar_hint=true</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG

15.02.window_signals

Example: File 15.02.window_signals


#! /bin/bash
export DIALOG='
<window title="Example Window" icon-name="gtk-dialog-warning">
<vbox>
<frame Description>
<text>
<label>Text</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>

</hbox>
</vbox>
<action signal="button-press-event">echo delete-event</action>
</window>
'
gtkdialog --program=DIALOG

16.00-fileselect

Example: File 16.00-fileselect


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Simple>
<hbox>
<entry>
<variable>FILE</variable>
</entry>
<button>
<input file stock="gtk-open"></input>
<variable>FILE_BROWSE</variable>
<action type="fileselect">FILE</action>
</button>
</hbox>
</frame>
<frame Filename>
<hbox>
<entry accept="filename">
<label>Select an Existing File</label>
<variable>FILE_FILENAME</variable>

</entry>
<button>
<input file stock="gtk-open"></input>
<variable>FILE_BROWSE_FILENAME</variable>
<action type="fileselect">FILE_FILENAME</action>
</button>
</hbox>
</frame>
<frame Filename for Save>
<hbox>
<entry accept="savefilename">
<label>Select a Filename</label>
<variable>FILE_SAVEFILENAME</variable>
</entry>
<button>
<input file stock="gtk-open"></input>
<variable>FILE_BROWSE_SAVEFILENAME</variable>
<action type="fileselect">FILE_SAVEFILENAME</action>
</button>
</hbox>
</frame>
<frame Directory>
<hbox>
<entry accept="directory">
<label>Select a Directory</label>
<variable>FILE_DIRECTORY</variable>
</entry>
<button>
<input file stock="gtk-open"></input>
<variable>FILE_BROWSE_DIRECTORY</variable>
<action type="fileselect">FILE_DIRECTORY</action>
</button>
</hbox>
</frame>
<frame New Directory>
<hbox>
<entry accept="newdirectory">
<label>Create New Directory (really)</label>
<variable>FILE_NEWDIRECTORY</variable>
</entry>
<button>
<input file stock="gtk-open"></input>
<variable>FILE_BROWSE_NEWDIRECTORY</variable>
<action type="fileselect">FILE_NEWDIRECTORY</action>
</button>
</hbox>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG

16.01.widget_signals

Example: File 16.01.widget_signals


#! /bin/bash
export DIALOG='
<window title="Example Window" icon-name="gtk-dialog-warning">
<vbox>
<frame Widgets>
<text>
<label>Label</label>
<action signal="button-press-event">echo Label: button-pressevent</action>
<action signal="button-release-event">echo Label: buttonrelease-event</action>
<action signal="configure-event">echo Label: configureevent</action>
<action signal="enter-notify-event">echo Label: enter-notifyevent</action>
<action signal="leave-notify-event">echo Label: leave-notifyevent</action>
<action signal="focus-in-event">echo Label: focus-inevent</action>
<action signal="focus-out-event">echo Label: focus-outevent</action>
<action signal="key-press-event">echo Label: key-pressevent</action>
<action signal="key-release-event">echo Label: key-releaseevent</action>
<action signal="hide">echo Label: hide</action>
<action signal="show">echo Label: show</action>
<action signal="map-event">echo Label: map-event</action>
<action signal="unmap-event">echo Label: unmap-event</action>
</text>
<entry>
<default>Entry</default>
<action signal="button-press-event">echo Entry: buttonpress_event</action>
<action signal="button-release-event">echo Entry: buttonrelease-event</action>
<action signal="configure-event">echo Entry: configureevent</action>
<action signal="enter-notify-event">echo Entry: enter-notifyevent</action>
<action signal="leave-notify-event">echo Entry: leave-notifyevent</action>
<action signal="focus-in-event">echo Entry: focus-inevent</action>

<action signal="focus-out-event">echo Entry: focus-outevent</action>


<action signal="key-press-event">echo Entry: key-pressevent</action>
<action signal="key-release-event">echo Entry: key-releaseevent</action>
<action signal="hide">echo Entry: hide</action>
<action signal="show">echo Entry: show</action>
<action signal="map-event">echo Entry: map-event</action>
<action signal="unmap-event">echo Entry: unmap-event</action>
</entry>
</frame>
<hbox>
<button ok>
<action signal="button-press-event">echo Button: buttonpress_event</action>
<action signal="button-release-event">echo Button: buttonrelease-event</action>
<action signal="configure-event">echo Button: configureevent</action>
<action signal="enter-notify-event">echo Button: enter-notifyevent</action>
<action signal="leave-notify-event">echo Button: leave-notifyevent</action>
<action signal="focus-in-event">echo Button: focus-inevent</action>
<action signal="focus-out-event">echo Button: focus-outevent</action>
<action signal="key-press-event">echo Button: key-pressevent</action>
<action signal="key-release-event">echo Button: key-releaseevent</action>
<action signal="hide">echo Button: hide</action>
<action signal="show">echo Button: show</action>
<action signal="map-event">echo Button: map-event</action>
<action signal="unmap-event">echo Button: unmap-event</action>
</button>
</hbox>
</vbox>
<action signal="button-press-event">echo Window: buttonpress_event</action>
<action signal="button-release-event">echo Window: button-releaseevent</action>
<action signal="configure-event">echo Window: configureevent</action>
<action signal="delete-event">echo Window: delete-event</action>
<action signal="destroy-event">echo Window: destroy-event</action>
<action signal="enter-notify-event">echo Window: enter-notifyevent</action>
<action signal="leave-notify-event">echo Window: leave-notifyevent</action>
<action signal="focus-in-event">echo Window: focus-in-event</action>
<action signal="focus-out-event">echo Window: focus-outevent</action>
<action signal="key-press-event">echo Window: key-pressevent</action>
<action signal="key-release-event">echo Window: key-releaseevent</action>
<action signal="hide">echo Window: hide</action>
<action signal="show">echo Window: show</action>
<action signal="map-event">echo Window: map-event</action>

<action signal="unmap-event">echo Window: unmap-event</action>


</window>
'
gtkdialog --program=DIALOG

16.02.widget_properties_default

Example: File 16.02.widget_properties_default


#! /bin/bash
export DIALOG='
<window title="Question" icon-name="gtk-dialog-question">
<vbox>
<hbox>
<text>
<label>Label:</label>
</text>
<entry activates-default="true">
<default>Default text</default>
<variable>ENTRY</variable>
</entry>
</hbox>
<hbox>
<button cancel></button>
<button can-default="true" has-default="true" use-stock="true">
<label>gtk-ok</label>
</button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=DIALOG

50.00-embedded_if

Example: File 50.00-embedded_if


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Imperative Example>
<checkbox active="true">
<label>First checkbox</label>
<variable>CHECKBOX</variable>
</checkbox>
<command assignment="n := 1"></command>

<while condition="n = 22">


<checkbox>
<label>The second checkbox</label>
</checkbox>
<command assignment="n := n + 1"></command>
</while>
</frame>
<hbox>
<button ok>
<variable>OKBUTTON</variable>
</button>
<button cancel></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG --print-ir
#gtkdialog --program=MAIN_DIALOG

90.00-event_driven

Example: File 90.00-event_driven


#! /usr/bin/gtkdialog -e
function print_this() {
echo "print: $1"
}
export MAIN_DIALOG='
<vbox>
<button>
<label>function</label>
<action>print_this button</action>
</button>
<button>
<label>Exit</label>
</button>
</vbox>
'

90.00-standalone_file

Example: File 90.00-standalone_file


#! /usr/bin/gtkdialog -f
<vbox>
<button>
<label>Xterm</label>
<action>xterm&</action>
</button>
<button>
<label>Exit</label>
</button>
</vbox>

90.01-input_file

Example: File 90.01-input_file


<vbox>
<hbox>
<text>
<label>Input:</label>
</text>
<entry>
<variable>ENTRY</variable>
</entry>
</hbox>
<hbox>
<button help></button>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>

90.01-print_ir

Example: File 90.01-print_ir


#! /bin/bash
export MAIN_DIALOG='
<vbox>
<hbox>
<button>
<label>Label</label>
<action>echo You pressed the button with the label.</action>
</button>
<button>
<input file>fileopen.xpm</input>
<action>echo You pressed the button with the pixmap.</action>
</button>
</hbox>

<hbox>
<button yes>
<action>echo You pressed
</button>
<button no>
<action>echo You pressed
</button>
</hbox>
<hbox>
<button ok>
<action>echo You pressed
</button>
<button cancel>
<action>echo You pressed
</button>
<button help>
<action>echo You pressed
</button>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>

the Yes button.</action>


the No button.</action>

the OK button.</action>
the Cancel button.</action>
the Help button.</action>

'
gtkdialog --program=MAIN_DIALOG --print-ir

You might also like