Ace3

AceGUI-3.0 Widgets

Base Widget APIs

This is a list of all commonly used and public APIs all widgets (and containers) share. There are additional APIs that are reserved for internal use by the Layout functions or the Widgets themself, and are not documented here.

widget:SetCallback(name, func)

Set the callback function of a specific callback. Only one function can be assigned to every callback.

Usage

local frame = AceGUI:Create("Frame")
frame:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end)

widget:SetWidth(width)

Sets the absolute width of the widget.
Calling this function will try to call :OnWidthSet on the widget, if defined.

widget:SetRelativeWidth(width)

Set the width of the widget relative to its container.
Any values between 0.0 and 1.0 are accepted, in percent.

widget:SetHeight(width)

Sets the absolute height of the widget.
Calling this function will try to call :OnHeightSet on the widget, if defined.

Note: Most widgets have a fixed pre-defined height, and changing their height is not recommended.

widget:IsVisible()

Return whether or not an object is actually visible on-screen.

widget:IsShown()

Determine if this object is shown (would be visible if its parent was visible).

widget:Release()

Release the widget back into the widget pool.

This is the equivalent to AceGUI:Release(widget)

widget:SetPoint(...)

Set an attachment point of this widget.
This function directly forwards to the base-frames :SetPoint

widget:ClearAllPoints()

Clear all attachment points of this widget.

widget:GetNumPoints()

Get the number of anchor points for this widget.

widget:GetPoint(...)

Get details for an anchor point for this widget.

widget:GetUserDataTable()

Return the internal user data table from this widget.

The User Data can be used to store information about this widget, and its functionality. Any User Data is wiped when the widget is released.

widget:SetUserData(key, value)

Set a key in the user data table.

widget:GetUserData(key)

Get the value of a specific user data key.

widget:SetFullHeight(isFull)

Set if the widget should use the full available height of its container.

widget:IsFullHeight()

Return if the widget is using the full height of its container.

widget:SetFullWidth(isFull)

Set if the widget should use the full available width of its container.

widget:IsFullWidth()

Return if the widget is using the full width of its container.


Widgets


Button

This widget is a default click-able Button.

APIs

  • SetText(text) - Set the Text to be displayed on the button.
  • SetDisabled(flag) - Disable the widget.

Callbacks

  • OnClick() - Fires when the button is clicked.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


CheckBox

A checkbox, optionally tri-state.

APIs

  • SetValue(flag) - Set the state of the checkbox
  • GetValue() - Get the state of the checkbox
  • SetType(type) - Set the type of the checkbox("radio" or "checkbox")
  • ToggleChecked() - Toggle the value
  • SetLabel(text) - Set the text for the label
  • SetTriState(state) - Enable/Disable the tri-state behaviour.
  • SetDisabled(flag) - Disable the widget.
  • SetDescription(description) - Set the description of the widget, shown as small text below it.
  • SetImage(path, ...) - Set the image of the checkbox. Optionally you can pass parameters to be passed to SetTexCoords (4 or 8 argument version)

Callbacks

  • OnValueChanged(value) - Fires when the state of the checkbox changes.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


ColorPicker

A small color-display widget which opens the ColorPicker frame when clicked.

APIs

  • SetColor(r, g, b, a) - Set the color
  • SetLabel(text) - Set the text for the label
  • SetHasAlpha(flag) - Set if the color picker has an alpha value
  • SetDisabled(flag) - Disable the widget.

Callbacks

  • OnValueChanged(r, g, b, a) - Fires when the color value is changed, but the color picker is still open.
  • OnValueConfirmed(r, g, b, a) - Fires when the color picker is closed.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


Dropdown

A select-box style box with a dropdown pullout.

APIs

  • SetValue(key) - Set the value to an item in the List.
  • SetList(table [, order]) - Set the list of values for the dropdown (key => value pairs). The order is a optional second table, that contains the order in which the entrys should be displayed (Array table with the data tables keys as values). Behaviour is undefined if you provide a order table that contains not the exact same keys as in the data table.
  • SetText(text) - Set the text displayed in the box.
  • SetLabel(text) - Set the text for the label.
  • AddItem(key, value) - Add an item to the list.
  • SetMultiselect(flag) - Toggle multi-selecting.
  • GetMultiselect() - Query the multi-select flag.
  • SetItemValue(key, value) - Set the value of a item in the list.
  • SetItemDisabled(key, flag) - Disable one item in the list.
  • SetDisabled(flag) - Disable the widget.

Callbacks

  • OnValueChanged(key [,checked]) - Fires when the selection changes. The second argument is send for multi-select dropdowns to indicate a change in one option.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


EditBox

A simple text input box.

APIs

  • SetText(text) - Set the text in the edit box.
  • GetText() - Get the text in the edit box.
  • SetLabel(text) - Set the text for the label.
  • SetDisabled(flag) - Disable the widget.
  • DisableButton(flag) - True to disable the "Okay" button, false to enable it again.
  • SetMaxLetters(num) - Set the maximum number of letters that can be entered (0 for unlimited).
  • SetFocus() - Set the focus to the editbox.

Callbacks

  • OnTextChanged(text) - Fires on every text change.
  • OnEnterPressed(text) - Fires when the new text was confirmed and should be saved.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


Heading

A horizontal line with a short label in the middle.

APIs

  • SetText(text) - Set the text to be displayed in the heading.

Callbacks

none


Icon

A click-able icon widget.

APIs

  • SetImage(image, ...) - Set the image to be shown. Additionally to the path, any extra arguments will be directly forwarded to :SetTexCoord.
  • SetImageSize(width, height) - Set the size of the image.
  • SetLabel(text) - Set the text for the label.

Callbacks

  • OnClick(button) - Fires when the icon is clicked.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


InteractiveLabel

A basic label which reacts to mouse interaction, optionally with an icon in front.

APIs

  • SetText(text) - Set the text.
  • SetColor(r, g, b) - Set the color of the text.
  • SetFont(font, height, flags) - Set the font of the text.
  • SetFontObject(font) - Set the font using a pre-defined font-object.
  • SetImage(image, ...) - Set the image to be shown. Additionally to the path, any extra arguments will be directly forwarded to :SetTexCoord.
  • SetImageSize(width, height) - Set the size of the image.
  • SetHighlight(...) - Set the highlight texture (either path to a texture, or RGBA values for a solid color)
  • SetHighlightTexCoord(...) - Set the tex coords for the highlight texture.

Callbacks

  • OnClick(button) - Fires when the label is clicked.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


Keybinding

A widget to control binding of keys.

APIs

  • SetKey(key) - Set the current key.
  • GetKey() - Set the current key.
  • SetLabel(text) - Set the text of the label.
  • SetDisabled(flag) - Disable the widget.

Callbacks

  • OnKeyChanged(key) - Fires when the key was changed.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


Label

A plain text, optionally with an icon in front.

APIs

  • SetText(text) - Set the text.
  • SetColor(r, g, b) - Set the color of the text.
  • SetFont(font, height, flags) - Set the font of the text.
  • SetFontObject(font) - Set the font using a pre-defined font-object.
  • SetImage(image, ...) - Set the image to be shown. Additionally to the path, any extra arguments will be directly forwarded to :SetTexCoord.
  • SetImageSize(width, height) - Set the size of the image.

Callbacks

none


MultiLineEditBox

A multiline editbox for text input.

APIs

  • SetText(text) - Set the text in the edit box.
  • GetText() - Get the text in the edit box.
  • SetLabel(text) - Set the text for the label.
  • SetNumLines(num) - Set the number of lines to be displayed in the editbox.
  • SetDisabled(flag) - Disable the widget.
  • SetMaxLetters(num) - Set the maximum number of letters that can be entered (0 for unlimited).
  • DisableButton(flag) - Disable the "Okay" Button
  • SetFocus() - Set the focus to the editbox.

Callbacks

  • OnTextChanged(text) - Fires on every text change.
  • OnEnterPressed(text) - Fires when the new text was confirmed and should be saved.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


Slider

A slider. Like, for ranges of values.

APIs

  • SetValue(value) - Set the current value of the slider.
  • GetValue() - Get the current value of the slider.
  • SetSliderValues(min, max, step) - Set the parameters of the slider. Minimum, maximum and the step value.
  • SetIsPercent(flag) - Set if the values are percentage values.
  • SetLabel(text) - Set the text for the label.
  • SetDisabled(flag) - Disable the widget.

Callbacks

  • OnValueChanged(value) - Fires when the value changed. (Fires *alot* when moving the slider with the mouse)
  • OnMouseUp(value) - Fires when the mouse is removed from the slider, and the movement stops at the final position.
  • OnEnter() - Fires when the cursor enters the widget.
  • OnLeave() - Fires when the cursor leaves the widget.


Base Container APIs

In addition to all Base Widget APIs, all Containers share another set of common APIs to manage the Layout and their child widgets.

container:AddChild(widget [, beforeWidget])

Add a new widget to the list of the containers children.
If beforeWidget is specified, the new widget will be inserted before this widget in the list, otherwise at the end.

container:SetLayout(layout)

Set the Layout this container should use when managing its child frames.
Currently implemented Layouts in AceGUI-3.0:
"Flow" - A row based flow layout
"List" - A simple stacking layout
"Fill" - Fill the whole container with the first widget (used by Groups)

container:SetAutoAdjustHeight(flag)

Enable/Disable the automatic height adjustment of containers.
If this is on (default), the container will resize vertically to fit all widgets in it.

This setting has no effect if a container is added in a "Fill" Layout, or if its set to use all available space (SetFullHeight).

container:ReleaseChildren()

Release all child frames of this container.

container:DoLayout()

Cause the container to re-layout all his child frames.

container:PauseLayout()

Suspend all layout operations until resumed.

container:ResumeLayout()

Resume layout operations after pause.


Containers


DropdownGroup

A group controlled by a dropdown on top of a big container frame.

APIs

  • SetTitle(text) - Set the title of the group.
  • SetGroupList(table [, order]) - Set the list of groups (key => value pairs) .The order is a optional second table, that contains the order in which the entrys should be displayed (Array table with the data tables keys as values). Behaviour is undefined if you provide a order table that contains not the exact same keys as in the data table.
  • SetGroup(key) - Set the active group.
  • SetDropdownWidth(width) - Set the width of the dropdown box.
  • SetStatusTable(table) - Set an external status table.

Callbacks

  • OnGroupSelected(group) - Fires when a new group selection occurs.


Frame

A simple stand-alone container widget, usually the base of any UI.

APIs

  • SetTitle(text) - Set the title of the frame.
  • SetStatusText(text) - Set the text in the status bar.
  • SetStatusTable(table) - Set an external status table.
  • ApplyStatus() - Apply the settings stored in the status table.

Callbacks

  • OnClose() - Fires when the frame is closed.
  • OnEnterStatusBar() - When the mouse enters the statusbar region of the frame.
  • OnLeaveStatusBar() - When the mouse leaves the statusbar region of the frame.


InlineGroup

A group designed to be used inline in other content, to group widgets.

APIs

  • SetTitle(text) - Set the title of the inline group.

Callbacks

none


ScrollFrame

A scrolling group, usually used inside another group to provide scrolling capabilities.
Note that the container containing the ScrollFrame should always be set to the "Fill" layout, or the ScrollFrame will not function properly.

scrollcontainer = AceGUI:Create("SimpleGroup") -- "InlineGroup" is also good
scrollcontainer:SetFullWidth(true)
scrollcontainer:SetFullHeight(true) -- probably?
scrollcontainer:SetLayout("Fill") -- important!

topContainer:AddChild(scrollcontainer)

scroll = AceGUI:Create("ScrollFrame")
scroll:SetLayout("Flow") -- probably?
scrollcontainer:AddChild(scroll)

-- ... add your widgets to "scroll"

APIs

  • SetScroll(value) - Set the scroll position.
  • SetStatusTable(table) - Set an external status table.

Callbacks

none


SimpleGroup

An empty group with no title or graphics.

APIs

none

Callbacks

none


TabGroup

A group controlled by tabs above it.

APIs

  • SetTitle(text) - Set the title of the group.
  • SetTabs(table) - Set the list of tabs. Tabs need to be provided as a array of {value = "key", text = "Visible Text" }. Additionally they can contain a "disabled" member.
  • SelectTab(key) - Select an tab.
  • SetStatusTable(table) - Set an external status table.

Callbacks

  • OnGroupSelected(group) - Fires when a new group selection occurs.
  • OnTabEnter(key, tab) - Fires when the cursor enters a tab.
  • OnTabLeave(key, tab) - Fires when the cursor leaves a tab.


TreeGroup

A tree-group widget.

The tree table

The basic tree-table is a array of sub-tables. Every entry in the array has to have a value and a text member, and an optional icon member.
An optional children member can be provided, which simply contains another complete tree.
Additionally, you can specify visible and disabled members to control the creation/behaviour of the table.

Example

--[[
   Alpha
   Bravo
     -Charlie
     -Delta
       -Echo
   Foxtrot
]]
tree = { 
  { 
    value = "A",
    text = "Alpha"
    icon = "Interface\\Icons\\INV_Drink_05",
  },
  {
    value = "B",
    text = "Bravo",
    children = {
      { 
        value = "C", 
        text = "Charlie"
      },
      {
        value = "D",	
        text = "Delta"
        children = { 
          { 
            value = "E",
            text = "Echo"
          } 
        }
      }
    }
  },
  { 
    value = "F", 
    text = "Foxtrot",
    disabled = true,
  },
}

APIs

  • SetTree(tree) - Set the tree to be displayed. See above for the format of the tree table.
  • SelectByPath(...) - Set the path in the tree given the raw keys.
  • SelectByValue(uniquevalue) - Set the path in the tree by a given unique value.
  • EnableButtonTooltips(flag) - Toggle the tooltips on the tree buttons.
  • SetStatusTable(table) - Set an external status table.

Callbacks

  • OnGroupSelected(group) - Fires when a new group selection occurs.
  • OnTreeResize(width) - Fires when the tree was resized by the user.
  • OnButtonEnter(path, frame) - Fires when the cursor enters a tree-button.
  • OnButtonLeave(path, frame) - Fires when the cursor leaves a tree-button.

You must login to post a comment. Don't have an account? Register to get one!

  • 2 comments
  • Avatar of oscarucb oscarucb Mar 08, 2011 at 01:13 UTC - 0 likes

    It's worth noting that InteractiveLabel:OnClick is actually an OnMouseDown handler, which specifically does NOT qualify as a hardware event. In contrast, Icon:OnClick and Button:OnClick are true OnClick events which supply a hardware event, which may be necessary for some handlers.

  • Avatar of Farmbuyer Farmbuyer Sep 12, 2010 at 21:01 UTC - 0 likes

    There is also a (new-ish) Window container not listed here; anybody looking for a Frame variant should check the Window code as well.

  • 2 comments

Table of contents

  1. 1 Base Widget APIs
    1. 1.1 widget:SetCallback(name, func)
    2. 1.2 widget:SetWidth(width)
    3. 1.3 widget:SetRelativeWidth(width)
    4. 1.4 widget:SetHeight(width)
    5. 1.5 widget:IsVisible()
    6. 1.6 widget:IsShown()
    7. 1.7 widget:Release()
    8. 1.8 widget:SetPoint(...)
    9. 1.9 widget:ClearAllPoints()
    10. 1.10 widget:GetNumPoints()
    11. 1.11 widget:GetPoint(...)
    12. 1.12 widget:GetUserDataTable()
    13. 1.13 widget:SetUserData(key, value)
    14. 1.14 widget:GetUserData(key)
    15. 1.15 widget:SetFullHeight(isFull)
    16. 1.16 widget:IsFullHeight()
    17. 1.17 widget:SetFullWidth(isFull)
    18. 1.18 widget:IsFullWidth()
  2. 2 Widgets
    1. 2.1 Button
      1. 2.1.1 APIs
      2. 2.1.2 Callbacks
    2. 2.2 CheckBox
      1. 2.2.1 APIs
      2. 2.2.2 Callbacks
    3. 2.3 ColorPicker
      1. 2.3.1 APIs
      2. 2.3.2 Callbacks
    4. 2.4 Dropdown
      1. 2.4.1 APIs
      2. 2.4.2 Callbacks
    5. 2.5 EditBox
      1. 2.5.1 APIs
      2. 2.5.2 Callbacks
    6. 2.6 Heading
      1. 2.6.1 APIs
      2. 2.6.2 Callbacks
    7. 2.7 Icon
      1. 2.7.1 APIs
      2. 2.7.2 Callbacks
    8. 2.8 InteractiveLabel
      1. 2.8.1 APIs
      2. 2.8.2 Callbacks
    9. 2.9 Keybinding
      1. 2.9.1 APIs
      2. 2.9.2 Callbacks
    10. 2.10 Label
      1. 2.10.1 APIs
      2. 2.10.2 Callbacks
    11. 2.11 MultiLineEditBox
      1. 2.11.1 APIs
      2. 2.11.2 Callbacks
    12. 2.12 Slider
      1. 2.12.1 APIs
      2. 2.12.2 Callbacks
  3. 3 Base Container APIs
    1. 3.1 container:AddChild(widget [, beforeWidget])
    2. 3.2 container:SetLayout(layout)
    3. 3.3 container:SetAutoAdjustHeight(flag)
    4. 3.4 container:ReleaseChildren()
    5. 3.5 container:DoLayout()
    6. 3.6 container:PauseLayout()
    7. 3.7 container:ResumeLayout()
  4. 4 Containers
    1. 4.1 DropdownGroup
      1. 4.1.1 APIs
      2. 4.1.2 Callbacks
    2. 4.2 Frame
      1. 4.2.1 APIs
      2. 4.2.2 Callbacks
    3. 4.3 InlineGroup
      1. 4.3.1 APIs
      2. 4.3.2 Callbacks
    4. 4.4 ScrollFrame
      1. 4.4.1 APIs
      2. 4.4.2 Callbacks
    5. 4.5 SimpleGroup
      1. 4.5.1 APIs
      2. 4.5.2 Callbacks
    6. 4.6 TabGroup
      1. 4.6.1 APIs
      2. 4.6.2 Callbacks
    7. 4.7 TreeGroup
      1. 4.7.1 The tree table
      2. 4.7.2 APIs
      3. 4.7.3 Callbacks

Facts

Date created
Apr 06, 2009
Last updated
Jun 20, 2011

Authors