MCListbox

From IfsoGUIWiki

Jump to: navigation, search

Contents

Multi-Column Listbox

Type: ifsoGUI_MCListbox
Module: ifsogui.mclistbox
Extends: ifsoGUI_Base
Imports: ifsogui.scrollbar, ifsogui.button, ifsogui.textbox, ifsogui.checkbox, ifsogui.combobox, ifsogui.progressbar

General

A multi-column listbox can be used as a standard multi-column listbox, or it can be used as a grid type control. It can have column header buttons that can be clicked and resized and row header buttons that can be resized. It is possible to assign a gadget style to each column so that when the cell is selected the gadget appears allowing the user to edit the value in place. Columns in the Multi-Column Listbox can have any of the following gadgets:

  • ifsoGUI_COLUMNTYPE_LABEL - A normal cell, no gadget.
  • ifsoGUI_COLUMNTYPE_TEXTBOX - A Textbox gadget.
  • ifsoGUI_COLUMNTYPE_CHECKBOX - A Checkbox gadget.
  • ifsoGUI_COLUMNTYPE_COMBOBOX - A Combobox gadget.
  • ifsoGUI_COLUMNTYPE_PROGRESSBAR - A Progressbar gadget.
  • ifsoGUI_COLUMNTYPE_SLIDER - A Slider gadget.

Events

  • ifsoGUI_EVENT_CLICK – Cell or header button has been clicked. Data contains the button that was pressed, MouseX is the column of the cell that was clicked, MouseY is the row of the cell that was clicked. MouseX/Y is set to -1 if the click did not occur on a cell. If a column button has been pressed, MouseX will be -2. If a row button has been pressed, MouseY will be -2.
  • ifsoGUI_EVENT_CHANGE – Row selection has changed. Data contains the current row.
  • ifsoGUI_EVENT_CELL_CHANGE – The value in a cell has been changed. Data contains the data passed by the child gadget, MouseX is the column of the changed cell, MouseY is the row of the changed cell.
  • ifsoGUI_EVENT_RESIZE – A column has been resized. Data contains the column that has been resized.
  • 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, MouseX, and MouseY are all 0.
  • ifsoGUI_EVENT_LOST_FOCUS – Gadget has lost the focus. Data, MouseX, and MouseY are all 0.

Functions

Functions used by the programmer to use the gadgets.

  • Create:ifsoGUI_MCListBox(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.

  • AddColumn(strTitle:String, iWidth:Int = 80, iType:Int = ifsoGUI_COLUMNTYPE_LABEL, strDefault:String = “”, iIndex:Int = -1) - Adds a column to the gadget.
  • AddRow(iIndex:Int = -1) - Adds a Row to the gadget.
  • AddSound(iSoundEvent:Int, sndSound:TSound) - Add a sound to the event of a gadget.
  • 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.
  • GetAbsoluteXY(iX:Int Var, iY:Int Var, caller:ifsoGUI_Base = Null) - Retrieves the gadgets Absolute x and y position.
  • GetActiveCell(iColumn:Int Var, iRow:Int Var) - Retrieves the active cell.
  • GetActualRowHeight:Int() - Returns the actual row height.
  • GetCellReadOnly:Int(iColumn:Int, iRow:Int) - Returns the ReadOnly property of the cell.
  • GetCellTip:String(iColumn:Int, iRow:Int) - Returns the tip of the cell.
  • GetCellValueInt:Int(iColumn:Int, iRow:Int) - Gets the cells value (int).
  • GetCellValueString:String(iColumn:Int, iRow:Int) - Gets the cells value (string).
  • GetColumnCellAlign:Int(iColumn:Int) - Returns the Alignment of the column cell text.
  • GetColumnCount:Int() - Returns the number of columns in the list.
  • GetColumnDefaultValue:String(iColumn:Int) - Gets the columns default value.
  • GetColumnHeaderAlign:Int(iColumn:Int) - Returns the Alignment of the column header text.
  • GetColumnMaxWidth:Int(iColumn:Int) - Returns the Columns Max Width.
  • GetColumnMinWidth:Int(iColumn:Int) - Returns the Columns Min Width.
  • GetColumnReadOnly:Int(iColumn:Int) - Returns the ReadOnly property of the column.
  • GetColumnShowGadgets:Int(iColumn:Int) - Returns whether or not the columns gadgets are showing.
  • GetColumnsResizable:Int() - Returns if the Columns can be resized.
  • 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.
  • GetHeaderActualColumnHeight:Int() - Returns the actual column header height.
  • GetHeaderActualRowWidth:Int() - Returns the actual row header width.
  • GetHeaderColumnHeight:Int() - Returns the requested column header height.
  • GetHeaderRowWidth:Int() - Returns the requested row header width.
  • GetHScrollbar:Int() - Gets whether or not the Horizontal Scrollbar will show.
  • GetMouseHighlight:Int() - Returns whether or not the highlight follows the mouse.
  • GetMultiSelect:Int() - Returns whether or not multiple items can be selected.
  • GetOverCell(iColumn:Int Var, iRow:Int Var) - Retrieves the cell the mouse is over.
  • GetProperty:Object(key:String) - Returns a custom property.
  • GetRowCount:Int() - Returns the number of rows in the list.
  • GetRowHeight:Int() - Returns the requested row height.
  • GetRowSelected:Int(iRow:Int) - Returns whether the row is selected or not.
  • GetScrollBarWidth:Int() - Returns the width of the scrollbars.
  • GetSelectedRow:Int() - Gets the last selected row.
  • GetShowBorder:Int() - Returns whether or not the border is showing.
  • GetShowColumnHeaders:Int() - Returns whether or not the column head buttons are showing.
  • GetShowFocus:Int() - Returns whether or not the gadget will show the focus box.
  • GetShowGrid:Int() - Returns whether or not the grid is showing.
  • GetShowRowHeaders:Int() - Returns whether or not the row head buttons are showing.
  • GetTabOrder:Int() - Returns the gadgets TabOrder.
  • GetTip:String() - Returns the gadgets tip text.
  • GetTopItem:Int() - Returns the top index of the gadget.
  • GetVisible:Int() - Returns whether the gadget is visible.
  • GetVisibleRows:Int() - Returns the number of items visible at a time in the gadget.
  • 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.
  • GetXY(iX:Int Var, iY:Int Var) - Retrieves the gadgets x and y positions.
  • RemoveAllColumns() - Removes all Columns from the gadget.
  • RemoveAllRows() - Removes all Rows from the gadget.
  • RemoveColumn(iColumn:Int) - Removes a column from the gadget.
  • RemoveRow(iRow:Int) - Removes a row from the gadget.
  • SendToBack() - Sends the gadget to the back of its parent child list.
  • SetActiveCell:Int(iColumn:Int, iRow:Int) - Sets the active cell. Returns True or False whether the cell was activated.
  • 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.
  • SetCellReadOnly(iColumn:Int, iRow:Int, bReadOnly:Int) - Sets the Readonly property of the cell.
  • SetCellTip(iColumn:Int, iRow:Int, strTip:String) - Sets the tip of the cell.
  • SetCellValueInt(iColumn:Int, iRow:Int, iValue:Int) - Sets the cells value (int).
  • SetCellValueString(iColumn:Int, iRow:Int, strValue:String) - Sets the cells value (string).
  • SetColumnCellAlign(iColumn:Int, iAlign:Int) - Sets the Columns cell text alignment.
  • SetColumnDefaultValue(iColumn:Int, strValue:String) - Sets the columns default value.
  • SetColumnHeaderAlign(iColumn:Int, iAlign:Int) - Sets the Columns header text alignment.
  • SetColumnMinMaxWidth(iColumn:Int, iMin:Int, iMax:Int) - Sets the Columns Min and Max Width.
  • SetColumnReadOnly(iColumn:Int, bReadOnly:Int) - Sets the Readonly property of all cells in the column.
  • SetColumnShowGadgets(iColumn:Int, bShowColumnGadgets:Int) - Sets whether or not the columns gadgets will show.
  • SetColumnsResizable(bResize:Int) - Sets if the columns can be resized.
  • SetEnabled(bEnabled:Int = True) - Sets the gadget enabled/disabled.
  • 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.
  • SetGridColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the color of the grid.
  • SetHeaderColumnHeight(iHeight:Int) - Sets the Column Header Height.
  • SetHeaderRowWidth(iWidth:Int) - Sets the Row Header Width.
  • SetHighlightColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the highlight color.
  • SetHighlightTextColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the highlight text color.
  • SetHScrollbar(iHScrollbar:Int) - Sets whether or not the Horizontal Scrollbar will show.
  • SetMouseHighlight(intMouseHighlight:Int) - Sets whether or not the highlight follows the mouse.
  • SetMultiSelect(bMultiSelect:Int) - Sets whether or not multiple items can be selected.
  • SetProperty(key:String, value:Object) - Set a custom property.
  • SetRowHeight(iRowHeight:Int) - Sets the row height. If requested height is less than the minimum, minimum is set.
  • SetRowReadOnly(iRow:Int, bReadOnly:Int) - Sets the Readonly property of all cells in the row.
  • SetScrollBarWidth(iWidth:Int) - Sets the width of the scrollbars.
  • SetSelectColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the selection color.
  • SetSelected(iRow:Int, bSelected:Int) - Sets the row selected/unselected.
  • SetSelectTextColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the select text color.
  • SetShowBorder(bShowBorder:Int) - Sets whether or not the border will show.
  • SetShowColumnHeaders(bShowColumnHeaders:Int) - Sets whether or not the column head buttons will show.
  • SetShowFocus(intShowFocus:Int) - Sets whether or not to show the focus box for this gadget.
  • SetShowGrid(bShowGrid:Int) - Sets whether or not the grid will show.
  • SetShowRowHeaders(bShowRowHeaders:Int) - Sets whether or not the row head buttons will show.
  • 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.
  • SetTopItem(intTopItem:Int) - Sets the top index of the gadget.
  • 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.
  • SetXY(iX:Int, iY:Int) - Sets the gadgets x and y position.
  • SortList(iColumn:Int, bDesc:Int = False, bSortAsInt:Int = False, bData:Int = False) - Sorts the list.

Column Gadget Methods

These Methods effect the functionality of the gadgets within columns.

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.
  • GetDirection:Int() - Returns the direction the graphic is facing in a Slider column.
  • 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: mclistbox
Filename: mclistbox.png
This is a representation of a listbox, the sides will be stretched the height of the listbox, the top and bottom will be stretched the width of the listbox, and the center will be stretched to the length and width of the listbox. The corners will remain as is and will not be stretched at all.

dimensions.txt keyword: mclistbox button
Filename: mclistboxbutton.png
Filename: mclistboxbuttondown.png
Filename: mclistboxbuttonover.png
This is a representation of the coolumn and row header buttons. The sides will be stretched the height of the tab, the top and bottom will be stretched the width of the tab, and the center will be stretched to the length and width of the tab. The corners will remain as is and will not be stretched at all. The mclistboxbuttondown.png and mclistboxbuttonover.png files are the pressed and mouseover images.

Column

Type: ifsoGUI_MCLColumn
Module: ifsogui.mclistbox
Extends: ifsoGUI_Button

General

Each column in a Multi-Column Listbox is a ifsoGUI_MCLColumn. The ifsoGUI_MCLColumn contains the columns properties and the columns gadgets. It is not necessary to interact with the columns directly, but it is possible. The MCListBox has a Columns[] array that contains the columns, in order.

Functions

  • Create:ifsoGUI_MCLColumn(iX:Int, iY:Int, iW:Int, iH:Int, strName:String, strLabel:String) - Create and returns a Multi Column List gadget.

Methods/Properties

These methods and properties pertain to specific gadgets in the columns. View the individual method details to see which methods pertain to which gadgets.

  • AddItem(strName:String, intData:Int, strTip:String) - Adds an item.
  • GetBarReversed:Int() - Gets if the bar is drawn reversed.
  • GetCursorWidth:Int() - Returns the width of the cursor bar.
  • GetDrawStyle:Int() - Returns the drawstyle.
  • GetInterval:Int() - Returns the amount the value changes per tick.
  • GetMax:Int() - Returns the maximum value of the gadget.
  • GetMin:Int() - Returns the minimum value of the gadget.
  • GetShowBorder:Int() - Returns whether or not the border is showing.
  • GetShowComboboxData:Int() - Returns what data from the Combobox appears in the column.
  • GetShowItems:Int() - Returns the number of items to show in a Combobox column dropdown box.
  • GetShowTicks:Int() - Returns if the slider ticks are being drawn or not.
  • InsertItem(intIndex:Int, strName:String, intData:Int, strTip:String) - Inserts an item.
  • RemoveAll() - Removes all items.
  • RemoveItem(intIndex:Int) - Removes an item.
  • SetBarColor(iRed:Int, iGreen:Int, iBlue:Int) - Sets the color of the bar.
  • SetBarReversed(intReversed:Int) - Sets if the bar is drawn reversed.
  • SetCursorWidth(iCursorWidth:Int) - Sets the width of the cursor bar.
  • SetDirection(intDirection:Int) - Sets the direction the graphic is facing.
  • SetDrawStyle(intStyle:Int) - Sets the draw style.
  • SetInterval(intInterval:Int) - Sets the amount the value changes per tick.
  • SetMax(intMax:Int) - Sets the maximum value of the gadget..
  • SetMin(intMin:Int) - Sets the minimum value of the gadget.
  • SetMinMax(intMin:Int, intMax:Int) - Sets the minimum and maximum values of the gadget in one call.
  • SetShowBorder(bShowBorder:Int) - Sets whether or not the border will show.
  • SetShowComboboxData(iData:Int) - Sets what data from the Combobox appears in the column.
  • SetShowItems(iNumItems:Int) - Sets the number of items to show in a Combobox column dropdown box.
  • SetShowTicks(intShowTicks:Int) - Sets if the ticks are shown or not.

Internal Functions

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

Cell

Type: ifsoGUI_MCLCell
Module: ifsogui.mclistbox

General

It is not necessary to interact with the cells directly, but it is possible. Each MCLColumn has a Rows[] array that contains its cells, in order.

Fields

  • Value:String - ‘Value in the row.
  • Selected:Int - Is this row selected. Only Column0 is updated.
  • Tip:String - Tip for this cell
  • ReadOnly:Int - Can this cell be edited
  • Data:Int - User data attached to this cell.
Personal tools