Wiki source for gtkdialogDocTips8


Show raw source

[[HomePage]] > [[SoftwareIndex|Software Index]] > [[SoftwareDevelopment|Development]] > [[gtkdialog|gtkdialog]] > [[gtkdialogDocTips|Tips and Tricks]]

====8. Text managing====

**INDEX**
[[gtkdialogDocTips8/#hn_8.1| Some options for the <text> widget]]
[[gtkdialogDocTips8/#hn_8.2| Advanced text layout]]
[[gtkdialogDocTips8/#hn_8.3| Scroll text]]
[[gtkdialogDocTips8/#hn_8.4| Strikethrough text]]
[[gtkdialogDocTips8/#hn_8.5| Set font]]
[[gtkdialogDocTips8/#hn_8.6| Hyperlink]]


==8.1==
**Some options for the <text> widget**
See [[https://github.com/puppylinux-woof-CE/gtkdialog/wiki/ reference guide]] for basic options.
Here follows undocumented options.

Justify aligment to right (1), center (2), left (3).
~##<text justify="2">##
Angle the text
~##<text angle="45">##
Force one-line text
~##<text wrap="false">##
~##<text single-line-mode="true">##
Set underline pattern
~##<text label="Underline me with an useless pattern" pattern="""__ __ __ __ __ __ _"""></text>##


==8.2==
**Advanced text layout**
__underline__, ##italic## and **Bold**.
~##<text use-markup="true"><label>"<u><i><b>test</b></i></u>"</label></text>##
Gtkdialog supports colors and size with the ##<span>## tag. The ##use-markup="true"## must be included.
~##<text use-markup="true"><label>"<span color='"'#789978'"'>test</span>"</label></text>##
Text size is set by the ##<big>## and ##<small>## tags. Repeat (up to 3 times) to increase value.
~##<text use-markup="true"><label>"<big><big><big>test</big></big></big>"</label></text>##
~##<text use-markup="true"><label>"<small><small><small>test</small></small></small>"</label></text>##
Vovchik has made an editor to test advanced text layout,
Check it out at [[http://www.murga-linux.com/puppy/viewtopic.php?t=40418]].


==8.3==
**Scroll text**
This example shows scrolling text in a ##<text>## widget. This will work for other widgets as well.

%%(language-ref)
export MSG="This is a test... I repeat: This is a test... "
export GTKBOX='
<vbox width-request="300">
<text>
<variable>MSG</variable>
<input>echo -en "${MSG:2}${MSG:0:2}"</input>
</text>
<timer milliseconds="true" interval="200" visible="false">
<action type="refresh">MSG</action>
</timer>
</vbox>'
gtkdialog -p GTKBOX
%%

==8.4==
**Strikethrough text**
Strikethrough text is supported by the ##use-markup="true"## option for text widgets.
~##<text use-markup="true"><label>"<s>test</s>"</label></text>##
This example shows strikethrough on request

%%(language-ref)
> /tmp/strikethrough
export DIALOG='
<window title="StrikeThrough" icon-name="gtk-strikethrough">
<vbox>
<edit wrap-mode="3">
<variable>EDIT</variable>
<default>write some text here</default>
<height>50</height>
</edit>
<edit file-monitor="true" auto-refresh="true" wrap-mode="3" editable="false">
<height>50</height>
<input file>/tmp/strikethrough</input>
</edit>
<hbox homogeneous="true">
<button>
<label>Strikethrough text</label>
<input file stock="gtk-ok"></input>
<action>`echo "$EDIT" | sed "s/./&\xCC\xB6/g" > /tmp/strikethrough`</action>
</button>
</hbox>
</vbox>
</window>'
gtkdialog -p DIALOG
%%

==8.5==
**Set font**
This is an example how to use other fonts even if gtkdialog hasn't an option to set this.

Gtkdialog does not support monospace in the ##<edit>## widget, but I can make it work by adding a unique gtk-theme only for my app. The best way to this is to add my new gtk-theme on top of the already existing. Now my gtk-theme can hold ONLY information about monospace, else it will use gtk-settings specified by user.

By giving the text-widget a name (see example), it is possible to have a gtk-theme for only this unique text string. This also works for text in widgets like <entry>.

%%(language-ref)
echo 'style "specialmono"
{
font_name="Mono 12"
}
widget "*mono" style "specialmono"
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono

export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0

export test_app="
<vbox>
<text name=\"mono\"><label>This text-widget uses monospace font....</label></text>
<text><label>...while this text-widget don't.</label></text>
<edit><default>All edit-widgets gets monospace.</default></edit>
</vbox>"
gtkdialog --program=test_app
%%

==8.6==
**Hyperlink**
Hyperlink is clickable text, often pointing user to a web page.

%%(language-ref)
<text selectable="true" use-markup="true">
<input>linkstyle "click here"</input>
<action signal="button-press-event">defaultbrowser '$LNK'</action>
</text>
%%
Other solutions including ##<eventbox>## is discussed at [[http://murga-linux.com/puppy/viewtopic.php?t=106458]]

===@@**#%[[gtkdialogDocTips7|❰❰❰ Previous]]#% #%[[gtkdialogDocTips|Index]]#% #%[[gtkdialogDocTips9.1|Next ❱❱❱]]#%**@@===
----
==Categories==
CategoryGtkdialog
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki