WoW:LegoBlock
Jump to navigation
Jump to search
Dongle Object LegoBlock-1.0 API
:New(name[, text, icon, optionsTbl])
Creates a new LegoBlock.
Args
| Arg | Type | Details |
|---|---|---|
| name | string | The name for your lego block. It will be prefixed with Lego. |
| text | string | (Optional) The initial text for the lego block. |
| icon | string/texture | (Optional) The initial texture for the icon on the lego block. |
| optionsTbl | table | (Optional) A table to store settings about the lego. Should be given as a LegoBlock optionsTbl |
Returns
| Return | Type | Details |
|---|---|---|
| legoBlock | frame | The frame created. It is a LegoBlock |
Remarks
The optionsTbl is used to store grouping information and should be of a permanent type storage like a SavedVariables table.
OptionsTbl
Format for the optionsTbl is thus:
| Key | Value Type | Details |
|---|---|---|
| width | int | The width of the LegoBlock |
| height | int | The height of the LegoBlock |
| text | string | The text on the LegoBlock |
| icon | string | The icon on the LegoBlock |
| x | int | the X coordinate for the center of the LegoBlock |
| y | int | The Y coordinate for the center of the LegoBlock |
| anchor | string | The anchor used for SetPoint'ing the LegoBlock |
| showIcon | boolean | Whether or not to show the icon. |
| showText | boolean | Whether or not to show the text. |
| hidden | boolean | Whether or not to show the LegoBlock. |
| noresize | boolean | Whether or not to resize the LegoBlock when you set the text. |
| group | string | List of LegoBlocks that are grouped with this LegoBlock. |
| appendstring | string | String to append to the CreateFrame call. |
[width] = int,
[height] = int,
[text] = string,
[icon] = string,
[x] = int,
[y] = int,
[anchor] = string,
[showIcon] = boolean,
[showText] = boolean,
[hidden] = boolean,
[group] = string separated by #,
[appendString] = string,
[savedFields] = integer indexed table with extra key/value pairs to fill in
Example
self:New("HelloWorld"[, "My first lego block", nil, {}])
LegoBlock Object API
LegoBlock:SetDB(optionsTbl)
Changes the optionsTbl attached to a lego block
Args
| Arg | Type | Details |
|---|---|---|
| optionsTbl | table | Sets the new optionsTbl for the lego block and restores settings based on the table |
Example
self:SetDB({})
LegoBlock:ShowIcon(state)
Shows or hides the icon
Args
| Arg | Type | Details |
|---|---|---|
| state | boolean | Shows or hides the icon. |
Example
self:ShowIcon(true)
LegoBlock:SetIcon(icon)
Sets the icon
Args
| Arg | Type | Details |
|---|---|---|
| icon | string/texture | Sets the icon for the lego block. |
Remarks
Does not automatically show the icon
Example
self:SetIcon(<fill me in>)
LegoBlock:SetText(text[, noresize])
Sets the text of the lego block
Args
| Arg | Type | Details |
|---|---|---|
| text | string | Sets the text of the lego block. |
| noresize | boolean | Controls whether or not it should resize the block when you set the text. Can be made permanent by settings noresize = true in the optionsTbl |
Remarks
You can set self.optionsTbl.noresize = true instead of setting noresize = true on each call.
Example
self:SetText("Woohooo", true)
LegoBlock:SetManyAttributes(...)
Taken from Frame:SetManyAttributes