File Control.lua

Generic Control Methods.
These methods are assigned to controls upon creation.
Some of them overload (hook or replace) existing creation methods.

Instead of using a control's type specific set/get methods you should use contol:SetValue(value) and control:GetValue() to update and check the control state and the saved variable.

Functions

Cancel (self) Undo changes to the value of this control
Disable (self) Disable the control so it cannot be clicked.
Enable (self) Enable the control for clicks.
GetValue (self) Get the value from the saved var or control.
Okay (self) Confirm changes to the value of this control
Refresh (self) Update the control state from the saved var if the value is different than the current control state.
Reset (self) Reset the control value to the default value if it is different than the current value.
SetHeaderText (self, text) Set the control header text.
SetText (self, text) Set the control text.
SetValue (self, value, isGUI, isUpdate) Update the saved var, the control state and the contol text.
Update (self) Update the control state from the saved var and call the callback.
UpdateBox (self) Update the control width to adjust text wrapping.
UpdateHeaderText (self) Update the control header text from control.headerText (dropdowns and editboxes)
UpdateText (self) Update the control text from control.text Also calls control:UpdateHeaderText() if it exists.
ValueEquals (self, value) Check if a value is equal to the current control value.

Tables

Portfolio.Control Generic Control Methods


Functions

Cancel (self)
Undo changes to the value of this control

Parameters

  • self: control

Usage:

control:Cancel()
Disable (self)
Disable the control so it cannot be clicked. Sets the text color to grey.

Parameters

  • self: control

Usage:

control:Disable()
Enable (self)
Enable the control for clicks. Restores the text color.

Parameters

  • self: control

Usage:

control:Enable()
GetValue (self)
Get the value from the saved var or control. This should also be the state of the control unless it hasn't been initialized. This will be the case if initCallbacks = false and Update has not been called, or if the variables haven't loaded yet.

Parameters

  • self: control

Usage:

value = control:GetValue()

Return value:

value
Okay (self)
Confirm changes to the value of this control

Parameters

  • self: control

Usage:

control:Okay()
Refresh (self)
Update the control state from the saved var if the value is different than the current control state. Also stores the current value to allow for canceling changes.

Parameters

  • self: control

Usage:

control:Refresh()
Reset (self)
Reset the control value to the default value if it is different than the current value.

Parameters

  • self: control

Usage:

control:Reset()
SetHeaderText (self, text)
Set the control header text. Sets control.headerText to the new value and calls control:UpdateHeaderText() (dropdowns and editboxes)

Parameters

  • self: control
  • text: (string) new text

Usage:

control:SetHeaderText(text)
SetText (self, text)
Set the control text. Sets control.text to the new value and calls control:UpdateText()

Parameters

  • self: control
  • text: (string) new text

Usage:

control:SetText(text)
SetValue (self, value, isGUI, isUpdate)
Update the saved var, the control state and the contol text.

Parameters

  • self: control
  • value: new value
  • isGUI: (boolean) called from a GUI interaction, passed to the callback
  • isUpdate: (boolean) called from control:Update(), passed to the callback

Usage:

control:SetValue(value)
Update (self)
Update the control state from the saved var and call the callback.

Parameters

  • self: control

Usage:

control:Update()
UpdateBox (self)
Update the control width to adjust text wrapping. Only needs to be called if the position of the control is moved or the parent frame was resized. (headers, texts, windows)

Parameters

  • self: header or text control

Usage:

control:UpdateBox()
UpdateHeaderText (self)
Update the control header text from control.headerText (dropdowns and editboxes)

Parameters

  • self: control

Usage:

control:UpdateHeaderText()
UpdateText (self)
Update the control text from control.text Also calls control:UpdateHeaderText() if it exists.

Parameters

  • self: control

Usage:

control:UpdateText()
ValueEquals (self, value)
Check if a value is equal to the current control value. Deep equals for table values (namely ColorPicker). Use instead of value == self:GetValue()

Parameters

  • self: control
  • value:

Usage:

isEqual = control:ValueEquals(value)

Return value:

(boolean) isEqual

Tables

Portfolio.Control
Generic Control Methods

Valid XHTML 1.0!