Combobox

From IfsoGUIWiki

Jump to: navigation, search

Contents

Combobox

Type: ifsoGUI_ComboBox
Module: ifsogui.combobox
Extends: ifsoGUI_Base
Imports: ifsogui.panel, ifsogui.listbox

General

The combobox can be used to offer a selection of items to the user. When the combobox is clicked, a drop down list appears allowing the user to make a selection. Items in this list are ifsoGUI_ListItems, the definition of which is part of the Listbox.

Events

  • ifsoGUI_EVENT_CHANGE – Gadget’s value has changed (user made a selection). Data contains the index of the selected item.
  • ifsoGUI_EVENT_CLICK – Gadget’s dropdown list has opened. Data, iMouseX, and iMouseY are set to 0.
  • ifsoGUI_EVENT_MOUSE_ENTER – Mouse has moved over the gadget. Data is set to 0.
  • ifsoGUI_EVENT_MOUSE_EXIT – Mouse has moved away from the gadget. Data is set to 0.
  • ifsoGUI_EVENT_GAIN_FOCUS – Gadget has gained the focus. Data, iMouseX, and iMouseY are set to 0.
  • ifsoGUI_EVENT_LOST_FOCUS – Gadget has lost the focus. Data, iMouseX, and iMouseY are set to 0.

Functions

Functions used by the programmer to use the gadgets.

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

  • AddItem(strName:String, intData:Int, strTip:String, bSelected:Int = False) - Adds an item to the combo box.
  • 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.
  • 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.
  • GetProperty:Object(key:String) - Returns a custom property.
  • GetSelected:Int() - Returns the index of the selected item.
  • GetSelectedData:Int() - Returns the data of the selected item.
  • GetSelectedItem:ifsoGUI_ListItem() - Returns the selected item.
  • GetSelectedName:String() - Returns the name of the selected item.
  • GetSelectedTip:String() - Returns the tip of the selected item.
  • GetShowFocus:Int() - Returns whether or not the gadget will show the focus box.
  • GetShowItems:Int() - Returns the number of items shown in the dropdown box.
  • GetTabOrder:Int() - Returns the gadgets TabOrder.
  • GetTip:String() - Returns the gadgets tip text.
  • GetVisible:Int() - Returns whether the gadget is visible.
  • 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.
  • InsertItem(intIndex:Int, strName:String, intData:Int, strTip:String, bSelected:Int = False) - Inserts an item into the combo box.
  • RemoveAll() - Removes all items from the combo box.
  • RemoveItem(intIndex:Int) - Removes an item from the combo box.
  • 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.
  • SetDropListFont(Font:TImageFont) - Sets the font of the drop list.
  • 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.
  • SetProperty(key:String, value:Object) - Set a custom property.
  • SetSelected(intIndex:Int) - Sets the selected index.
  • SetShowFocus(intShowFocus:Int) - Sets whether or not to show the focus box for this gadget.
  • SetShowItems(iNumItems:Int) - Sets the number of items to show in the dropdown box.
  • 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.
  • SetVisible(bVisible:Int) - Sets whether the gadget is visible.
  • SetWH(width:Int, height:Int) - Sets the gadgets width and height.
  • SetXY(iX:Int, iY:Int) - Sets the gadgets x and y position.
  • SortList(bDesc:Int = False, bSortAsInt:Int = False, bData:Int = False) - Sorts the list.

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.

  • CalcBox() - Calculates the location and size of the dropdown box.
  • 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.
  • HideDropBox() - Hides the dropbox.
  • 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.
  • NextGadget:ifsoGUI_Base(start:ifsoGUI_Base, bForward:Int = True) - Returns the next gadget after start in the child list.
  • Refresh() - Refreshes the gadget.
  • ShowDropBox() - Shows the drop box.
  • 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: combobox
Filename: combobox.png
Filename: comboboxdown.png
Filename: comboboxover.png
This is the large portion of the combobox that has the text in it, the sides will be stretched or tiled the height of the combobox, the top and bottom will be stretched or tiled the width of the combobox, and the center will be stretched or tiled to the length and width of the combobox. The corners will remain as is and will not be stretched or tiled at all. This graphic is only the left portion of the combobox graphic and is combined with the comboboxbutton.png graphic to make the entire combobox. The comboboxdown.png and comboboxover.png files are the pressed and mouse over graphics and are optional. If not included, the combobox.png graphic will be used.

dimensions.txt keyword: combobox button
Filename: comboboxbutton.png
Filename: comboboxbuttondown.png
Filename: comboboxbuttonover.png
This is the portion of the combobox that has the down arrow in it, the sides will be stretched or tiled the height of the button, the top and bottom will be stretched or tiled the width of the button, and the center will be stretched or tiled to the length and width of the button. The corners will remain as is and will not be stretched or tiled at all. This graphic is only the right portion of the combobox graphic and is combined with the combobox.png graphic to make the entire combobox. The combobuttondown.png and combobuttonover.png files are the pressed and mouse over graphics and are optional. If not included, the combobutton.png graphic will be used.

dimensions.txt keyword: combobox drop
Filename: combodrop.png
This is the dropdown portion of the combobox where the list will reside, the sides will be stretched or tiled the height of the dropdown panel, the top and bottom will be stretched or tiled the width of the dropdown panel, and the center will be stretched or tiled to the length and width of the dropdown panel. The corners will remain as is and will not be stretched or tiled at all.

Filename: arrow.png
This is the arrow that will be placed on the end of the combobox button. This graphic should normally be pointing to the right.

Personal tools