MLTextbox

From IfsoGUIWiki

Jump to: navigation, search

Contents

Multi-Line Textbox

Type: ifsoGUI_MLTextbox
Module: ifsogui.mltextbox
Extends: ifsoGUI_Base
Imports: ifsogui.scrollbar

General

A multi-line textbox displays a large block of text. It can have word wrapping turned on or off and scrollbars can be set on, off, or on when needed. A multi-line textbox also offers rudimentary editing capability if desired.

Events

  • ifsoGUI_EVENT_CLICK – Gadget has been clicked with the mouse.
  • ifsoGUI_EVENT_KEYHIT – Key was pressed while the gadget has focus. Data contains the key value. MouseX/Y are set to 0.
  • ifsoGUI_EVENT_CHANGE – Gadget’s value has changed. data and MouseX/Y are set to 0. Only occurs when the gadget has lost focus and the text has been changed.
  • ifsoGUI_EVENT_MOUSE_ENTER – Mouse has moved over the gadget. Data is 0.
  • ifsoGUI_EVENT_MOUSE_EXIT – Mouse has moved away from the gadget. Data is 0.
  • ifsoGUI_EVENT_GAIN_FOCUS – Gadget has gained the focus. Data and MouseX/Y are set to 0.
  • ifsoGUI_EVENT_LOST_FOCUS – Gadget has lost the focus. Data and MouseX/Y are set to 0.
  • ifsoGUI_EVENT_CUT - User has requested a Cut. (Ctrl-X).
  • ifsoGUI_EVENT_COPY - User has requested a Copy. (Ctrl-C).
  • ifsoGUI_EVENT_PASTE - User has requested a Paste. (Ctrl-V).

Functions

Functions used by the programmer to use the gadgets.

  • Create:ifsoGUI_MLTextBox(iX:Int, iY:Int, iW:Int, iH:Int, strName:String) - Creates and returns an instance of the gadget.

Methods/Properties

These are the methods and properties used by the programmer to use the gadgets.

  • AddSound(iSoundEvent:Int, sndSound:TSound) - Add a sound to the event of a gadget.
  • AddText(strText:String) - Appends text to the textbox.
  • BringToFront() - Brings the gadget to the front of its parents child list.
  • CanActive:Int() - Returns whether or not this gadget can be the active gadget.
  • CutSelection:String() - Returns the selected text and removes it from the gadget.
  • GetAbsoluteXY(iX:Int Var, iY:Int Var, caller:ifsoGUI_Base = Null) - Retrieves the gadgets Absolute x and y position.
  • GetCurrentLine:Int() - Returns the current cursor line.
  • GetCursorBlinkRate:Int() - Returns the rate at which the cursor blinks.
  • GetEnabled:Int() - Returns whether the gadget is enabled.
  • GetFont:TImageFont() - Returns the font the gadget is using.
  • GetGadgetAlpha:Float() - Returns the gadgets alpha value.
  • GetH:Int() - Returns the gadgets height.
  • GetHScrollbar:Int() - Gets whether or not the Horizontal Scrollbar will show.
  • GetLinePos:Int() - Returns the current cursor position on the line.
  • GetNumLines:Int() - Returns the current number of lines.
  • GetProperty:Object(key:String) - Returns a custom property.
  • GetReadOnly:Int() - Returns whether the textbox is read only or not.
  • GetScrollBarWidth:Int() - Returns the width of the scrollbars.
  • GetSelectCursorBegin:Int() - Returns the location of the selection beginning cursor position.
  • GetSelection:String() - Returns the selected text.
  • GetSelectLineBegin:Int() - Returns the location of the selection beginning line.
  • GetShowBorder:Int() - Returns whether or not the border is showing.
  • GetShowFocus:Int() - Returns whether or not the gadget will show the focus box.
  • GetTabOrder:Int() - Returns the gadgets TabOrder.
  • GetTip:String() - Returns the gadgets tip text.
  • GetTopLine:Int() - Returns the index of the top visible line.
  • GetValue:String() - Returns all of the text in the textbox.
  • GetVisible:Int() - Returns whether the gadget is visible.
  • GetVisibleLines:Int() - Returns the number of visible lines.
  • GetVScrollbar:Int() - Gets whether or not the Vertical Scrollbar will show.
  • GetW:Int() - Returns the gadgets width.
  • GetWH(width:Int Var, height:Int Var) - Retrieves the gadgets width and height.
  • GetWordWrap:Int() - Returns whether word wrap is on or off.
  • GetXY(iX:Int Var, iY:Int Var) - Retrieves the gadgets x and y positions.
  • InsertText(strText:String) - Inserts text at the cursor position.
  • SendToBack() - Sends the gadget to the back of its parent child list.
  • SetBounds(iX:Int, iY:Int, iW:Int, iH:Int) - Sets the x, y, width, and height all in one call.
  • SetCallBack(func(gadget:ifsoGUI_Base, id:Int, data:Int, iMouseX:Int, iMouseY:Int)) - Sets the event callback function for the gadget.
  • SetCurrentLine(intCurrentLine:Int) - Sets the current cursor line.
  • SetCursorBlinkRate(iBlinkRate:Int) - Sets the blink rate of the cursor.
  • SetEnabled(bEnabled:Int = True) - Sets the gadget enabled/disabled.
  • SetFilter(funcFilter:Int(key:Int, gadget:ifsoGUI_Base)) - Sets the function to use to filter keypresses.
  • SetFocus() - Gives the gadget the focus.
  • SetFocusColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the gadgets focus box color.
  • SetFont(Font:TImageFont) - Sets the font of the gadget.
  • SetGadgetAlpha(fltAlpha:Float) - Sets the gadgets alpha value.
  • SetGadgetColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the gadget color of the gadget.
  • SetHScrollbar(iHScrollbar:Int) - Sets whether or not the Horizontal Scrollbar will show.
  • SetLinePos(intLinePos:Int) - Sets the cursor line position.
  • SetProperty(key:String, value:Object) - Set a custom property.
  • SetReadOnly(bReadOnly:Int) - Sets the gadget read only.
  • SetScrollBarWidth(iWidth:Int) - Sets the width of the scrollbars.
  • SetSelectColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the selection color.
  • SetSelectCursorBegin(iBegin:Int) - Sets The Selection begining.
  • SetSelectLineBegin(iBegin:Int) - Sets The Selection begining.
  • SetShowBorder(bShowBorder:Int) - Sets whether or not the border will show.
  • SetShowFocus(intShowFocus:Int) - Sets whether or not to show the focus box for this gadget.
  • SetTabOrder(iTabOrder:Int) - Sets the gadgets TabOrder. 0=Do not tab to this gadget -1=Last in the Tab Order
  • SetTextColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the text color of the gadget.
  • SetTip(strTip:String) - Sets the gadget tip text.
  • SetValue(strValue:String) - Sets the text in the textbox.
  • SetVisible(bVisible:Int) - Sets whether the gadget is visible.
  • SetVScrollbar(iVScrollbar:Int) - Sets whether or not the Vertical Scrollbar will show.
  • SetWH(width:Int, height:Int) - Sets the gadgets width and height.
  • SetWordWrap(intWordWrap:Int) - Sets word wrap on or off.
  • SetXY(iX:Int, iY:Int) - Sets the gadgets x and y position.

Internal Functions

These function are internal to the gadget. They should only need to be called, if you are creating a gadget.

  • Drawbox(images:TImage[], ws:Int[], hs:Int[], rX:Int, rY:Int, rW:Int, rH:Int, bDrawBorder:Int = True, bTileSides:Int = False, bTileCenter:Int = False) - Draws the standard ifsoGUI image based on 4 corners, 4 sides, and a center background portion.
  • GetDimensions:String(strName:String) - Gets the dimensions from the dimension file for the gadgets graphics.
  • Load9Image(srcpath:String, dimensions:String[], gImage:TImage[] Var, imagew:Int[] Var, imageh:Int[] Var) - Loads the graphics for an image in 9 standard parts.
  • LoadTheme() - Called when a new theme is loaded, so the gadget can load its images for drawing. The base gadget does not have a LoadTheme function, but any gadget than can be created should have one.
  • SystemEvent(id:Int, data:Int) - Called when a system level event occurs that all gadgets should know about, like loading a new theme or changing the default GUI font. The base gadget does not have a SystemEvent function, but any gadget than can be created should have one.

Internal Methods

These methods are called by the GUI itself and should only be used if you are creating your own gadget.

  • Compare:Int(withObject:Object) - Compares two gadgets by TabOrder.
  • Draw(parX:Int, parY:Int, parW:Int, parH:Int) - Draws the gadget and its children.
  • DrawFocus(iX:Int, iY:Int, iW:Int, iH:Int) - Draws the focus box around the gadget.
  • DrawTip(iMouseX:Int, iMouseY:Int) - Draws the gadgets tip.
  • GadgetSystemEvent(id:Int, data:Int) - Gadget Level GUI system event occured.
  • GainFocus(LostFocus:ifsoGUI_Base) - Called when the gadget becomes the active gadget.
  • gMouseDown(iButton:Int, iMouseX:Int, iMouseY:Int) - Called when the mouse button is pressed on the gadget.
  • gMouseUp(iButton:Int, iMouseX:Int, iMouseY:Int) - Called when the mouse button is released on the gadget.
  • IsMouseOver:Int(parX:Int, parY:Int, parW:Int, parH:Int, iMouseX:Int, iMouseY:Int) - Returns whether or not the mouse is over the gadget.
  • IsMyChild:Int(gadget:ifsoGUI_Base) - Is the gadget a child or slave of this gadget.
  • IsMySlave:Int(gadget:ifsoGUI_Base) - Is the gadget a slave of this gadget.
  • KeyPress(key:Int) - Called when a key is pressed on the active gadget.
  • LostFocus(GainedFocus:ifsoGUI_Base) - Called when the gadget is no longer the Active Gadget.
  • MouseOut(iMouseX:Int, iMouseY:Int, gOverGadget:ifsoGUI_Base) - Called when the mouse leaves the gadget.
  • MouseOver(iMouseX:Int, iMouseY:Int, gWasOverGadget:ifsoGUI_Base) - Called when the mouse is over this gadget.
  • MouseStatus:Int(iMouseX:Int, iMouseY:Int) - Called to determine the mouse status from the gadget.
  • Refresh() - Refreshes the gadget.
  • SendEvent(id:Int, data:Int, iMouseX:Int, iMouseY:Int) - Sends an event from the gadget.
  • SlaveEvent(gadget:ifsoGUI_Base, id:Int, data:Int, iMouseX:Int, iMouseY:Int) - Called from a slave gadget.

Skinning

dimensions.txt keyword: mltextbox
Filename: mltextbox.png
This is a representation of a multi-line textbox, the sides will be stretched or tiled the height of the textbox, the top and bottom will be stretched or tiled the width of the textbox, and the center will be stretched or tiled to the length and width of the textbox. The corners will remain as is and will not be stretched or tiled at all.

Personal tools