Contents | Index | < Browse | Browse >
xTEXTBOX L T W H Title Text
A xTEXTBOX is a very versatile graphic that can serve a lot of
purposes. It main purpose is to display text easily and colourfully
but it can also be used as a container to differentiate different
parts of a gui etc.
A xTEXTBOX is a graphic, not a gadget, since it can not be selected.
You can, however, give it a GADID and SetGad it HIDE/SHOW and also
you can UPDATE its text.
The basic xTEXTBOX takes as arguments its size and position, its
title and its text. A lot more, however, can be configured through
the following Attributes :
Attribute to control the look of the text within the box :
-----------------------------------------------------------
* TBSTYLE apen/bpen/drawmode/justify
- apen, bpen : are the pens that will be used to draw the text.
"bpen" will be used as the shadow or outline.
- drawmode : can be PLAIN or SHADOW or OUTLINE.
- justify : can be LEFT or CENTER or RIGHT and will justify the
text accordingly within the bounds of the box.
The inner horizontal & vertical margins can be set globally with
SET TBMARGINS Horizontal/Vertical (default is 5/4 pixels)
Example :
> xTEXTBOX 10 10 100 20 "My Title" "Some sample text here.."
ATTR TBSTYLE 2/1/SHADOW/CENTER
Attribute to control the look of the box itself :
--------------------------------------------------------------
* TBOX apen/bpen/bgpen/border/recess
- apen, bpen : these are the pens that will be used to draw the
title text. "bpen" will be used as shadow/outline
- bgpen : this is the background color of the textbox. You
can give a -1 if you do not want a background.
- drawmode : PLAIN or SHADOW or OUTLINE
- border : NONE, PLAIN, BUTTON, RIDGE or ICONDROP
(and I'm not going to explain what each one is..)
- recess : "IN" to have the border recessed, OUT otherwise.
Example :
> ATTR TBOX 2/1/3/RIDGE/OUT
Example : Run Gui Source
The title (if it's not "", ie empty) will be drawn in plain style
above and left of the gadget. You can leave this field empty though
by giving "" and declare a TITLE attribute instead.
The text inside the xTEXTBOX can be changed with the UPDATE command.
> Update #this 3 "Other text.."
If you may want to show the contents of a File in a xTextBox, you
can use the READVAR command to get the file (or part of it) into
a variable and then update the xTextBox :
> ReadVar Ram:MyFile 0 500 myvar ; read the first 500 bytes into myvar
> Update #this 3 $myvar ; update the xTextBox..