Revision history for gtkdialogDocTips9.12
Additions:
[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]]
===@@**#%[[gtkdialogDocTips9.11|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.13|Next ❱❱❱]]#%**@@===
===@@**#%[[gtkdialogDocTips9.11|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.13|Next ❱❱❱]]#%**@@===
Deletions:
@@**#%[[gtkdialogDocTips9.11|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.13|Next ❱❱❱]]#%**@@
Additions:
====9.12 Let <entry> accept (some) numbers only====
The following example shows how to limit the user input to a ##<entry>##. Useful for 'all' kinds of settings.
export MAIN_DIALOG='
<text>
<label>"Enter a number (text will default to 0)"</label>
</text>
<entry editable="true" allow-empty="false">
<input>case $ENTRY in ""|*[^0-9]*) echo 0;; *) echo $ENTRY ;; esac</input>
<variable>ENTRY</variable>
<action signal="focus-out-event">refresh:ENTRY</action>
</entry>
<text>
<label>"Enter a number within [5,15], otherwise:
input will be capped at 15,
floored at 5,
or set to 10 in case of text input"</label>
</text>
<entry editable="true" allow-empty="false">
<input>A=$ENTRY2; case $A in [0-9]*) [[ $A -gt 15 ]] && echo 15 || [[ $A -lt 5 ]] && echo 5 || echo $A ;; *) echo 10;; esac</input>
<variable>ENTRY2</variable>
<action signal="focus-out-event">refresh:ENTRY2</action>
</entry>
<button ok></button>
</vbox>'
gtkdialog -p MAIN_DIALOG
unset MAIN_DIALOG
@@**#%[[gtkdialogDocTips9.11|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.13|Next ❱❱❱]]#%**@@
The following example shows how to limit the user input to a ##<entry>##. Useful for 'all' kinds of settings.
export MAIN_DIALOG='
<text>
<label>"Enter a number (text will default to 0)"</label>
</text>
<entry editable="true" allow-empty="false">
<input>case $ENTRY in ""|*[^0-9]*) echo 0;; *) echo $ENTRY ;; esac</input>
<variable>ENTRY</variable>
<action signal="focus-out-event">refresh:ENTRY</action>
</entry>
<text>
<label>"Enter a number within [5,15], otherwise:
input will be capped at 15,
floored at 5,
or set to 10 in case of text input"</label>
</text>
<entry editable="true" allow-empty="false">
<input>A=$ENTRY2; case $A in [0-9]*) [[ $A -gt 15 ]] && echo 15 || [[ $A -lt 5 ]] && echo 5 || echo $A ;; *) echo 10;; esac</input>
<variable>ENTRY2</variable>
<action signal="focus-out-event">refresh:ENTRY2</action>
</entry>
<button ok></button>
</vbox>'
gtkdialog -p MAIN_DIALOG
unset MAIN_DIALOG
@@**#%[[gtkdialogDocTips9.11|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.13|Next ❱❱❱]]#%**@@
Deletions:
- skip taskbar, sticky, layer, border
**Window on top**
echo -n '<window type-hint="6" window-position="1">
<edit justification="2" cursor-visible="false">
<default>"
This window stays on top
Has no window decoration
Can not be resized
Can not be moved
"</default>
</edit>
<button></button>
</vbox>
</window>'|gtkdialog -s
**JWM - specific**
This is how to override default settings in your JWM configuration.
Your gtkdialog gui must be called with the ##--class parameter##
##gtkdialog --class=APPLET -f myfile##
Then this code must be in your jwm configuration file - ##$HOME/.jwmrc## (to be set permanently, it must be added to ##/etc/xdg/templates/_root_.jwmrc##)
<Group>
<Class>APPLET</Class>
<Option>nolist</Option>
<Option>sticky</Option>
<Option>noborder</Option>
<Option>layer:above</Option>
- ##nolist## does avoid your app showing up in the taskbar.
- ##sticky## shows your app on all desktops.
- ##noborder## is equal to the gtkdialog attribute ##<window decorated="false">##.
- ##layer:n## defines if other windows should cover your app, or if it should be on top. below, normal or above.
@@**#%[[gtkdialogDocTips9.10|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.12|Next ❱❱❱]]#%**@@