GUIScrollTextBox
This class is very handy when you have more information than space or if you just want a box with text in it. It will automatically handle new lines for you, and it has some fun parameters.
Properties
Public Properties
- GUIScrollText MyScrollText
- A Subobject which defines text this box displays.
- bool bRepeat
- Repeat the sequence.
- bool bNoTeletype
- Don't do the teletyping effect at all.
- bool bStripColors
- Strip out IRC-style colour characters (^C)
- float InitialDelay
- Initial delay after new content was set
- float CharDelay
- This is the delay between each char
- float EOLDelay
- This is the delay to use when reaching end of line
- float RepeatDelay
- This is used after all the text has been displayed and bRepeat is true
- eTextAlign TextAlign
- How is text Aligned in the control
Methods
Inherited From GUIComponent
- InitComponent (GUIController MyController, GUIComponent MyOwner)
New Methods
- SetContent (string NewContent, optional string sep)
- Sets/Replaces text in MyScrollText
- Restart ( )
- Sets values in MyScrollText to defaults.
- Stop ( )
- bool SkipChar ( )
- InternalOnAdjustTop (GUIComponent Sender)
- Called by MyScrollText's delegate OnAdjustTop, stops text scrolling.
- bool IsNumber (string Num)
- string StripColors (string MyString)
- Removes IRC color codes
- AddText (string NewText)
- Concatenates text and uses MyScrollText.Separator.
Using It
Besides probably declaring it as a Subobject in a subclass of GUIPage you will need to do a couple of things to make use of it. This GUIComponent is somewhat unique in having functions to set its variables: AddText and SetContent.
TextBox.SetContent("Hi, I'm GUI text box."); TextBox.AddText("You may know me from such scripts as: \"Mango, the Vengeance\" and \"Where Did My Function Go?\"");
This will give you a textbox that will display (linewrapped):
Hi, I'm GUI text box. You may know me from such scripts as: "Mango, the Vengeance" and "Where Did My Function Go?"
Now, if you want to intentionally go to the next line, there's something specific for that. The var Separator. If you set this, it will automatically insert this between existing text and your argument in AddText(). Note that it will not be inserted if you do not put anything in AddText().
AlphaOne: Is there any way to "disable" or stop the insertion of the separator? I would like to display a sequence of dots "..." displayed with a delay, one line.
Haral: Err well, if you don't set the Separator to anything, it will be "" and thus won't insert anything. If all you want to do is display "..." on one line with a delay, you set the InitialDelay and say TextBox.SetContent("..."); Note that there is a set rate it "writes" the text at, I'm not sure where that's set.
Evolution: The rate at which it writes the characters out is stored in the CharDelay variable
TextBox.SetContent("Hi, I'm GUI text box.", Chr(13)); TextBox.MyScrollText.Separator = Chr(13); //Set a newline separator. Redundant with second SetContent parameter. TextBox.AddText("You may know me from such scripts as: \"Mango, the Vengeance\" and \"Where Did My Function Go?\"");
Hi, I'm GUI Text box.
You may know me from such scripts as: "Mango, the Vengeance" and "Where Did My Function Go?"
I, or somebody else, can update this a bit later with all of its class info. —Haral
Haral: Oops. This page sort of combined GUIScrollTextBox and GUIScrollText. I started it, so I'll fix it.