Revision history for gtkdialogDocTips4.1


Revision [33321]

Last edited on 2023-02-24 06:47:59 by zigbert
Additions:
[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]]
By default, gtkdialog always activates the first ##[[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/radiobutton <radiobutton>]]## and the first list-item for ##[[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/combobox <combobox>]]##.
Now let's go to the main script. For the ##[[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/radiobutton <radiobutton>]]## and the ##[[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/entry <entry>]]##, we set the ##<default>## tag to the corresponding variable in the config file. Since the ##[[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/combobox <combobox>]]## doesn't support the ##<default>## tag, we need a workaround. We simply build the ##[[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/combobox <combobox>]]## item-list so show our saved variable first.
===@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@===
Deletions:
[[HomePage]] > [[SoftwareIndex Software Index]] > [[SoftwareDevelopment Development]] > [[gtkdialog gtkdialog]] > [[gtkdialogDocTips Tips and Tricks]]
By default, gtkdialog always activates the first ##[[http://01micko.com/reference/radiobutton.html <radiobutton>]]## and the first list-item for ##[[http://01micko.com/reference/combobox.html <combobox>]]##.
Now let's go to the main script. For the ##[[http://01micko.com/reference/radiobutton.html <radiobutton>]]## and the ##[[http://01micko.com/reference/entry.html <entry>]]##, we set the ##<default>## tag to the corresponding variable in the config file. Since the ##[[http://01micko.com/reference/combobox.html <combobox>]]## doesn't support the ##<default>## tag, we need a workaround. We simply build the ##[[http://01micko.com/reference/combobox.html <combobox>]]## item-list so show our saved variable first.
@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@


Revision [33316]

Edited on 2023-02-24 06:45:00 by zigbert
Additions:
@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@
Deletions:
===@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@===


Revision [33315]

Edited on 2023-02-24 06:44:06 by zigbert
Additions:
===@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@===
Deletions:
@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@


Revision [32889]

Edited on 2020-07-28 05:12:06 by zigbert

No Differences

Revision [32886]

Edited on 2020-07-28 05:09:55 by zigbert
Additions:
====4.1 Set default status of radiobuttons, Comboboxes...====
@@**#%[[gtkdialogDocTips3|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips4.2|Next ❱❱❱]]#%**@@
Deletions:
====4. The benefits of a config file====
==**Set default status of radiobuttons, Comboboxes...**==
==**How to store window size/placement**==
This example shows how we can save settings for window size and placement for next startup. Be also aware that this solution makes it possible to let user rescale gui smaller than the default size. Normally you define the size of, for example, a <tree>, and the user can only resize the gui larger, but when using <window default_height="$HEIGHT" default_width="$WIDTH">, you don't need to define <height> and <width> for the tree widget.
save_geometry (){
XWININFO=`xwininfo -stats -name SizeMe`
HEIGHT=`echo "$XWININFO" | grep 'Height:' | awk '{print $2}'`
WIDTH=`echo "$XWININFO" | grep 'Width:' | awk '{print $2}'`
X1=`echo "$XWININFO" | grep 'Absolute upper-left X' | awk '{print $4}'`
Y1=`echo "$XWININFO" | grep 'Absolute upper-left Y' | awk '{print $4}'`
X2=`echo "$XWININFO" | grep 'Relative upper-left X' | awk '{print $4}'`
Y2=`echo "$XWININFO" | grep 'Relative upper-left Y' | awk '{print $4}'`
X=$(($X1-$X2))
Y=$(($Y1-$Y2))
echo "export HEIGHT=$HEIGHT" > /tmp/geometry
echo "export WIDTH=$WIDTH" >> /tmp/geometry
echo "export X=$X" >> /tmp/geometry
echo "export Y=$Y" >> /tmp/geometry
chmod 700 /tmp/geometry
}
export -f save_geometry
[ -f /tmp/geometry ] && . /tmp/geometry
export DIALOG="
<window title=\"SizeMe\" default_height=\"$HEIGHT\" default_width=\"$WIDTH\">
<frame>
<text>
<label>If you resize or move this window, it will be remembered for next time.</label>
</text>
<button ok>
</button>
<action signal=\"hide\">save_geometry</action>
gtkdialog --program=DIALOG --geometry +"$X"+"$Y"
Another approach for size/placement is to make a call of your app from the cli.
RIGHT=14; DOWN=36; WIDTH=80; HEIGHT=80 # define variables with defaults
GUI='
<button cancel></button>
</vbox>'
gtkdialog -p GUI -G ${1-${WIDTH}x${HEIGHT}+${RIGHT}+${DOWN}}


Revision [32885]

The oldest known version of this page was created on 2020-07-28 05:07:52 by zigbert
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki