Thank you!Geoffrey wrote:Try wrapping the progressbar with an eventbox, that should work.mavrothal wrote:I was wondering if there is a way to make a progress bar clickable.
That did it.
Thank you!Geoffrey wrote:Try wrapping the progressbar with an eventbox, that should work.mavrothal wrote:I was wondering if there is a way to make a progress bar clickable.
Code: Select all
ENTRY=8;[ $ENTRY -gt 0 ] && xmessage true
Code: Select all
ENTRY=`echo "9:00:09" | sed 's/://g'`;[ $ENTRY -ge 0 ] && xmessage true
Wouldn't it be easier to eliminate everything that is not a digit?don570 wrote:Note that an error is passed to shell if variable is ordinary text
Perhaps adapting this approach-MochiMoppel wrote:don570 wrote:
Anyway, time entry can be tricky. You would need more tests to catch invalid times like 25:11:22 or 22:1:122.
Code: Select all
[[ $time_entry =~ ^[0-2]?[0-9]:[0-5][0-9]:[0-5][0-9]$ ]] && echo yes
Would still allow 25:11:22seaside wrote:Perhaps adapting this approach-Code: Select all
[[ $time_entry =~ ^[0-2]?[0-9]:[0-5][0-9]:[0-5][0-9]$ ]] && echo yes
Code: Select all
[[ $time_entry =~ ^([0-1]?[0-9]|2[0-3])(:[0-5]?[0-9]){0,2}$ ]] && echo true
Code: Select all
[[ $time_entry =~ ^([0-1][0-9]|2[0-3])(:[0-5][0-9]){2}$ ]] && echo true
Substring Replacement
${string/substring/replacement}
Replace first match of $substring with $replacement. [2]
${string//substring/replacement}
Replace all matches of $substring with $replacement.
??? Both suggestions are only examples. Feel free to adjust them to meet your requirements. I don't understand why say you don't know if the user entered 7 or 8 characters. The second example makes the input of 8 characters mandatory. No ambiguities whatsoever.don570 wrote:A problem with MochiMoppel's suggestion is I don't know if
the user has entered seven or eight characters, so I need to check
first.
Why? Bash substring replacement is the ideal tool for this job. Sed could do it as well but would be much slower.I should have used sed command to eliminate the colons.
Code: Select all
# Add a zero at beginning if user left this out
if [ "${#TIME_FUTURE}" = 7 ] ;then
TIME_FUTURE=`echo "0""$TIME_FUTURE"`
fi
Code: Select all
[ 09 -gt 7 ] && echo true
recobayu wrote:Hi All,
how to close gtkdialog by "Esc" key?
Thank you
Code: Select all
<window>
(your code)
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">exit:EXIT</action>
</window>
Code: Select all
#!/bin/sh
export MAIN='
<hbox>
<vbox>
<text><label>block-false</label></text>
<entry block-function-signals="false">
<variable>BLOCK_FALSE</variable>
<input>date +%s</input>
<action signal="changed">echo BLOCK_FALSE</action>
</entry>
<button>
<label>Refresh</label>
<action>refresh:BLOCK_FALSE</action>
</button>
</vbox>
<vbox>
<text><label>block-true</label></text>
<entry block-function-signals="true">
<variable>BLOCK_TRUE</variable>
<input>date +%s</input>
<action signal="changed">echo BLOCK_TRUE</action>
</entry>
<button>
<label>Refresh</label>
<action>refresh:BLOCK_TRUE</action>
</button>
</vbox>
</hbox>'
gtkdialog -p MAIN
So, based on this, my understanding is that the motivation for using block-function-signals is function and not performance. Set it true to fence off actions that do not correspond to manual user changes. For example set it true if you want to trigger the skip forward/backward action only when a user changes the slider value (by dragging it) and for no other reason. Hopefully I'm getting it right.zigbert wrote:block-function-signals was introduced after my request. See
http://www.murga-linux.com/puppy/viewto ... 704#544704
edit: ini mgkn yg anda maurecobayu wrote:Can we cange label based on entry? I mean when we change text on entry, the label change directly live perform.
Code: Select all
#!/bin/bash -a
function echotext ()
{
echo "$NEWTEXT" > /tmp/text.txt
}
echo "OLD TEXT" > /tmp/text.txt
export GUI="
<window title="Auto" icon-name="gtk-edit">
<vbox>
<timer milliseconds="true" interval="200" visible="false">
<action type="refresh">TEXT</action>
<action type="refresh">NEWTEXT</action>
</timer>
<text>
<input>cat /tmp/text.txt</input><variable>TEXT</variable>
</text>
<entry>
<variable>"NEWTEXT"</variable>
<action>echotext &</action>
</entry>
</vbox>
</window>"
gtkdialog --program=GUI
Code: Select all
#!/bin/sh
echo > labelku
export a='<window>
<vbox>
<entry>
<action signal="changed">echo $e > labelku</action>
<action signal="changed">refresh:t</action>
<variable>e</variable>
</entry>
<text>
<input file>labelku</input>
<variable>t</variable>
</text>
</vbox>
</window>'
gtkdialog -p a