I think it's not possible, but question in case of
About button label
Code: Select all
<button>
<variable>okbutton</variable>
<label>"'`date`'"</label>
<action>refresh:okbutton</action>
</button>
Thx
Code: Select all
<button>
<variable>okbutton</variable>
<label>"'`date`'"</label>
<action>refresh:okbutton</action>
</button>
Labels are fixed even before gtkdialog starts.fabrice_035 wrote:The button take value only after load ? Update is not possible ?
Code: Select all
#!/bin/bash
update_icon () {
echo '<''svg width="100" height="20"><text x="50%" y="70%" text-anchor="middle">'"$(date +%T)"'</text></svg>' > /tmp/buticon.svg
}; export -f update_icon
update_icon
echo '
<button>
<variable>BUT</variable>
<input file>/tmp/buticon.svg</input>
<action>echo do something useful here</action>
<action>update_icon</action>
<action>refresh:BUT</action>
</button>
'|gtkdialog -s
rm /tmp/buticon.svg
Code: Select all
#!/bin/bash
function update_icon()
{
echo '<''svg width="300" height="60">' \
'<rect x="1%" y="1%" rx="5%" ry="10%" width="98%" ' \
'height="98%" fill="darkorange" stroke="darkred" ' \
'stroke-width="3.5"/> <text x="50%" ' \
'stroke="darkred" stroke-opacity="1.0" stroke-width="2.4" ' \
'fill="white" fill-opacity="1.0" font-weight="800" ' \
'font-size="50" font-family="Sans" ' \
'y="78%" text-anchor="middle">'"$(date +%T)"'' \
'</text></svg>' > /tmp/buticon.svg
}
export -f update_icon
update_icon
echo '
<button>
<variable>BUT</variable>
<input file>/tmp/buticon.svg</input>
<action>echo "Do something useful here..."</action>
<action>update_icon</action>
<action>refresh:BUT</action>
</button>
'|gtkdialog -s
rm /tmp/buticon.svg
Code: Select all
<timer tag_attr="value"...>
<variable>varname</variable>
<input>command</input>
<input file>filename</input>
<sensitive>state</sensitive>
<action>activity</action>...
<action signal="type">activity</action>...
<action function="type">parameter</action>...
</timer>
Code: Select all
#!/bin/bash
touch /tmp/myfile
echo '
<button>
<variable>BUT</variable>
<label>press me</label>
<action>echo "button down"</action>
</button>
<timer visible="true" milliseconds="true" file-monitor="true">
<input file>/tmp/myfile</input>
<action>echo "working signal"</action>
</timer>
'| gtkdialog -s
Code: Select all
#!/bin/bash
touch /tmp/myfile
echo '
<button>
<variable>BUT</variable>
<label>press me</label>
<action>date > /tmp/myfile</action>
</button>
<timer visible="true" milliseconds="true" file-monitor="true">
<input file>/tmp/myfile</input>
<action signal="file-changed">echo "working signal"</action>
</timer>
'| gtkdialog -s
Code: Select all
#!/bin/bash
#
touch /tmp/enable_button
touch /tmp/disable_button
# rem
myscript () {
echo "script execute until end and disable button, user must wait"
echo 0 > /tmp/disable_button
#...
sleep 5
#...
echo 0 > /tmp/enable_button
echo "enable now!"
} ; export -f myscript
echo '
<button>
<variable>BUT</variable>
<label> START </label>
<action>myscript&</action>
</button>
<timer visible="true" milliseconds="true" file-monitor="true" >
<input file>/tmp/disable_button</input>
<action signal="file-changed">disable:BUT</action>
</timer>
<timer visible="true" milliseconds="true" file-monitor="true" >
<input file>/tmp/enable_button</input>
<action signal="file-changed">enable:BUT</action>
</timer>
'| gtkdialog -s
Code: Select all
<combobox>
<variable>COMBOBOX</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
<action>echo yes > /tmp/tmpfile</action>
</combobox>
Code: Select all
<action signal="changed">echo changed item!</action>
http://01micko.com/reference/combobox.htmldon570 wrote:Looking at docs
http://01micko.com/reference/combobox.html
Various action signals are mentioned.
__________________________________________
Code: Select all
The following signals are connected-up for all widgets:
button-press-event, button-release-event, configure-event, enter-notify-event, leave-notify-event, focus-in-event, focus-out-event, hide, show, realize, key-press-event, key-release-event, map-event, unmap-event
I had a look to this page which is in my favorites... but I make the same observation as fabrice_035 (que je salue au passage! ): I didn't get any results!don570 wrote:Looking at docs
http://01micko.com/reference/combobox.html
Various action signals are mentioned.
__________________________________________
Code: Select all
<action signal="changed">echo changed item!</action>
I'm afraid you are right.fabrice_035 wrote:I think is wrong, u can try.
I hope I'm wrong.
Code: Select all
/* Connect signals */
Code: Select all
/* Connect signals */
g_signal_connect(G_OBJECT(var->Widget), "changed",
G_CALLBACK(on_any_widget_changed_event),
(gpointer)var->Attributes);
(...)
Code: Select all
(gtkdialog:30539): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.40.2/./gobject/gsignal.c:2462: signal 'toggled' is invalid for instance '0x916d918' of type 'GtkComboBox'
Code: Select all
* Thu Nov 1 2012 Thunor <thunorsif@hotmail.com>
- Connected-up the button-press/release-event signals to the
comboboxentry widget's child entry widget.
Code: Select all
g_signal_connect(G_OBJECT(gtk_bin_get_child(
GTK_BIN(var->Widget))), "button-press-event",
G_CALLBACK(on_any_widget_button_pressed),
(gpointer)var->Attributes);
g_signal_connect(G_OBJECT(gtk_bin_get_child(
GTK_BIN(var->Widget))), "button-release-event",
G_CALLBACK(on_any_widget_button_released),
(gpointer)var->Attributes);
Code: Select all
Bonsoir,
Is it possible to execute a command when a combobox widget is clicked to select an item in the list (for example to echo some message to any temporary file)? If yes, how?
Code: Select all
#!/bin/sh
#
# find more here http://blogs.czapski.id.au/category/demo-building/gtkdialog
# fxc
export ytdlgui='
<window title="event box demonstration">
<hbox>
<eventbox above-child="false" visible-window="true" has-tooltip="true" tooltip-markup="This is tooltip for eventbox" height-request="30" sensitive="true" visible="true" width-request="140">
<hbox>
<frame All Events here>
<comboboxtext>
<variable>COMBOBOXTEXT</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
<action signal="changed">echo Combobox: changed</action>
</comboboxtext>
</frame>
</hbox>
<variable>vEventBoxOuter</variable>
<action signal="button-press-event">echo Event: button-press-event</action>
<action signal="button-release-event">echo Event: button-release-event</action>
<action signal="configure-event">echo Event: configure-event</action>
<action signal="enter-notify-event">echo Event: enter-notify-event</action>
<action signal="leave-notify-event">echo Event: leave-notify-event</action>
<action signal="focus-in-event">echo Event: focus-in-event</action>
<action signal="focus-out-event">echo Event: focus-out-event</action>
<action signal="key-press-event">echo Event: key-press-event</action>
<action signal="key-release-event">echo Event: key-release-event</action>
<action signal="hide">echo Event: hide</action>
<action signal="show">echo Event: show</action>
<action signal="realize">echo Event: realize</action>
<action signal="map-event">echo Event: map-event</action>
<action signal="unmap-event">echo Event: unmap-event</action>
</eventbox>
<frame dedicate >
<comboboxtext>
<variable>COMBOBOXTEXT2</variable>
<item>First item</item>
<item>Second item</item>
<item>Third item</item>
<action signal="changed">echo Combobox: changed</action>
</comboboxtext>
</frame>
</hbox>
</window>'
gtkdialog --program=ytdlgui
Code: Select all
#!/bin/sh
echo "My_tailor_is_rich
My tailor is NOT rich" > /tmp/checkbox_test
FILE="`cat /tmp/checkbox_test`"
for LINE in $FILE; do
LIST="${LIST}
<checkbox>
<variable>$LINE</variable>
<default>true</default>
<label>$LINE</label>
<action>if false disable:$LINE</action>
<action>sed -i 's/$LINE//' /tmp/checkbox_test</action>
<action>refresh:TEXT</action>
</checkbox>
"
done
export MAIN="
<window window_position=\"1\">
<vbox>
<hbox border-width=\"5\">
<frame Text (/tmp/checkbox_test)>
<edit>
<input file>/tmp/checkbox_test</input>
<variable>TEXT</variable>
</edit>
</frame>
<frame Checkboxes>
${LIST}
</frame>
</hbox>
<hbox>
<button><input file stock=\"gtk-undo\"></input>
<label>$(gettext 'Reset')</label>
<action>EXIT:restart</action>
</button>
<button cancel></button>
</hbox>
</vbox>
</window>
"
I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog --program=MAIN); do
eval $STATEMENTS
done
IFS=$I
[ "$EXIT" = "restart" ] && $0