SetVisible
Show
Hide
PtInItem
SetRelX
SetRelY
GetRelX
GetRelY
SetAbsX
SetAbsY
GetAbsX
GetAbsY
SetW
SetH
GetW
GetH
SetRelPos
GetRelPos
SetAbsPos
GetAbsPos
SetSize
GetSize
SetPosType
GetPosType
IsVisible
GetName
SetName
SetTip
GetTip
SetUserData
GetUserData
RegisterEvent
ClearEvent
EnableScale
Scale
LockShowAndHide
SetAlpha
GetAlpha
GetParent
GetRoot
GetType
GetIndex
SetIndex
ExchangeIndex
GetTreePath
SetAreaTestFile
SetIntPos
IsIntPos
IsLink
GetLinkInfo
SetLinkInfo
GetAniParamID
IsValid
__eq
GetBaseType
Set Item Visibility.
(
void
) ItemNull:SetVisible(bool
bVisible)
ItemNull:SetVisible(false)
Show Item, same as :SetVisible(true)
.
(
void
) ItemNull:Show()
ItemNull:Show()
Hide Item, same as :SetVisible(false)
.
(
void
) ItemNull:Hide()
ItemNull:Hide()
Judge if a given screen position is in this Item. Always use with Cursor.GetPos()
.
(
bool
bIsInItem) ItemNull:PtInItem(number
nX,number
nY)
local bIsInItem = ItemNull:PtInItem(600, 800)
local bIsInItem = ItemNull:PtInItem(Cursor.GetPos())
Set Item's relative X (to its parent).
(
void
) ItemNull:SetRelX(number
nX)
ItemNull:SetRelX(10)
Set Item's relative Y (to its parent).
(
void
) ItemNull:SetRelY(number
nY)
ItemNull:SetRelY(10)
Get Item's relative X (to its parent).
(
number
nX) ItemNull:GetRelX()
local nX = ItemNull:GetRelX()
Get Item's relative Y (to its parent).
(
number
nY) ItemNull:GetRelY()
local nY = ItemNull:GetRelY()
Set Item's absolute X (to the screen).
(
void
) ItemNull:SetAbsX(number
nX)
ItemNull:SetAbsX(10)
Set Item's absolute Y (to the screen).
(
void
) ItemNull:SetAbsY(number
nY)
ItemNull:SetAbsY(10)
Get Item's absolute X (to the screen).
(
number
nX) ItemNull:GetAbsX()
local nX = ItemNull:GetAbsX()
Get Item's absolute Y (to the screen).
(
number
nY) ItemNull:GetAbsY()
local nY = ItemNull:GetAbsY()
Set Item's width.
(
void
) ItemNull:SetW(number
nW)
ItemNull:SetW(100)
Set Item's height.
(
void
) ItemNull:SetH(number
nW)
ItemNull:SetH(100)
Get Item's width.
(
number
nW) ItemNull:GetW()
local nW = ItemNull:GetW()
Get Item's height.
(
number
nH) ItemNull:GetH()
local nH = ItemNull:GetH()
Set Item's relative position. The union of :SetRelX
and :SetRelY
.
(
void
) ItemNull:SetRelPos(number
nX,number
nY)
ItemNull:SetRelPos(100, 200)
Get Item's relative position. The union of :GetRelX
and :GetRelY
.
(
number
nX,number
nY) ItemNull:GetRelPos()
local nX, nY = ItemNull:GetRelPos()
Set Item's relative position. The union of :SetAbsX
and :SetAbsY
.
(
void
) ItemNull:SetAbsPos(number
nX,number
nY)
ItemNull:SetAbsPos(500, 300)
Get Item's relative position. The union of :GetAbsX
and :GetAbsY
.
(
number
nX,number
nY) ItemNull:GetAbsPos()
local nX, nY = ItemNull:GetAbsPos()
Set Item's size. The union of :SetW
and :SetH
.
(
void
) ItemNull:SetSize(number
nW,number
nH)
ItemNull:SetSize(600, 800)
Get Item's size. The union of :GetW
and :GetH
.
(
number
nW,number
nH) ItemNull:GetSize()
local nW, nH = ItemNull:GetSize()
Set Item's position type. See the enum of ITEM_POSITION
.
(
void
) ItemNull:SetPosType()
ItemNull:SetPosType(ITEM_POSITION.RIGHT_BOTTOM)
Get Item's position type. See the enum of ITEM_POSITION
.
(
enum
nPosType) ItemNull:GetPosType()
local nPosType = ItemNull:GetPosType()
Get Item's visibility.
(
bool
bVisible) ItemNull:IsVisible()
local bVisible = ItemNull:IsVisible()
Get Item's name.
(
string
szName) ItemNull:GetName()
local szName = ItemNull:GetName()
Set Item's name.
(
void
) ItemNull:SetName(string
szName)
ItemNull:SetName("Item_001")
Set Item's tip. When mouse enter it, the tip will be shown.
(
void
) ItemNull:SetTip(string
szTip)
ItemNull:SetTip('<text>text="this is a tip"</text>')
Get Item's tip.
(
string
szTip) ItemNull:GetTip()
local szTip = ItemNull:GetTip()
Set a number to the Item.
(
void
) ItemNull:SetUserData(number
nData)
ItemNull:SetUserData(27)
Get Item's userdata.
(
number
nData) ItemNull:GetUserData()
local nData = ItemNull:GetUserData()
Register an ui event so that this item is able to response the specified ui event such as mouse click event.
(
void
) ItemNull:RegisterEvent(number
nUIEvent)
ItemNull:RegisterEvent(256)
Clear all ui event on this Item.
(
void
) ItemNull:ClearEvent()
ItemNull:ClearEvent()
Set if this Item can be scaled.
(
void
) ItemNull:EnableScale(bool
bEnableScale)
ItemNull:EnableScale(true)
Scale an Item. Please noticed that it's children will also be scaled. And remember to save the scale to some place because there is no api to get current scale level. The working principle of this api is just traverse all its children and itself and make their width and height multiplied with the given scale value.
(
void
) ItemNull:Scale(number
fScaleX,number
fScaleY)
ItemNull:Scale(0.7, 0.9)
Set if this Item's default visibility is invisible.
(
void
) ItemNull:LockShowAndHide(bool
bEnable)
ItemNull:LockShowAndHide(true)
Set its alpha. The value can be set between 0 and 255.
(
void
) ItemNull:SetAlpha(number
nAlpha)
ItemNull:SetAlpha(255)
Get its alpha value (0 - 255).
(
number
nAlpha) ItemNull:GetAlpha()
local nAlpha = ItemNull:GetAlpha()
Get its parent node. It will return null
if it has no parent.
(
KGUI OBJECT
pParent) ItemNull:GetParent()
local hParent = ItemNull:GetParent()
Get its root parent node (the frame).
(
KGUI Frame
pFrame) ItemNull:GetRoot()
local hFrame = ItemNull:GetRoot()
Get its ui type, such as WndWindow
, Handle
, Text
, etc.
(
string
szType) ItemNull:GetType()
local szType = ItemNull:GetType()
Get its index. The value will between 0 and the count of its brothers.
(
number
nIndex) ItemNull:GetIndex()
local nIndex = ItemNull:GetIndex()
Set its index. The value must between 0 and the count of its brothers.
(
void
) ItemNull:SetIndex(number
nIndex)
ItemNull:SetIndex(0)
Exchange the index with one of its brothers.
- (
void
) ItemNull:ExchangeIndex(number
nIndex)- (
void
) ItemNull:ExchangeIndex(KGUI Object
pBrotherItem)
ItemNull:ExchangeIndex(0)
ItemNull:ExchangeIndex(ItemNull:GetParent():Lookup(0))
Get the tree path of this Item.
(
string
szWndTreePath,string
szHandleTreePath) ItemNull:GetTreePath()
local szWndTreePath, szHandleTreePath = ItemNull:GetTreePath()
Check if this Item is still vaild. Once the Item get destroyed, this api will return false
.
(
bool
bValid) ItemNull:IsValid()
local bValid = ItemNull:IsValid()
Get its base type. The value can be Item
or Wnd
.
(
string
szBaseType) ItemNull:GetBaseType()
local szBaseType = ItemNull:GetBaseType()
SetFontScheme
GetFontScheme
SetRange
SetTime
SetNumber
GetNumber
SetText
GetText
GetTextLen
SetVAlign
GetVAlign
SetHAlign
GetHAlign
SetRowSpacing
GetRowSpacing
SetMultiLine
IsMultiLine
FormatTextForDraw
AutoSize
SetCenterEachLine
IsCenterEachLine
SetFontSpacing
GetFontSpacing
SetRichText
IsRichText
GetFontScale
SetFontScale
SetFontID
SetFontColor
SetFontBorder
SetFontShadow
GetFontID
GetFontColor
GetFontBoder
GetFontProjection
GetTextExtent
GetTextPosExtent
Set text font scheme.
This api will load pFontScheme
by nFontID
, and then call this:
:SetFontID(pFontScheme->nFontID)
:SetFontColor(pFontScheme->GetFontColor())
:SetFontBorder(pFontScheme->nBorderSize, pFontScheme->GetBoderColor())
:SetFontShadow(pFontScheme->nShadowOffset, pFontScheme->GetShadowColor())
:SetFontScale(pFontScheme->fScale)
(
void
) ItemText:SetFontScheme(number
nFont)
ItemText:SetFontScheme(192)
Get text font scheme.
(
number
nFont) ItemText:GetFontScheme()
local nFont = ItemText:GetFontScheme()
Set text as range format. Notice that this api is the same as :SetText(nValue1 .. szDelimiter .. nVlaue2)
. But this api is high performanced than :SetText
cause there is no intermediate string when concat string.
- (
void
) ItemText:SetRange(number
nValue,string
szDelimiter)- (
void
) ItemText:SetRange(number
nValue1,string
szDelimiter,number
nValue2)
ItemText:SetRange(5, "%")
ItemText:SetRange(5, "/", 100)
Set text as time format. Notice that this api is the same as :SetText(("%02d:%02d:%02d"):format(TimeToHMS(nTime)))
. But this api is high performanced than :SetText
cause there is no intermediate string when concat string.
(
void
) ItemText:SetTime(number
nTimeStamp)
ItemText:SetTime(GetCurrentTime())
Set text as pure number. Notice that this api is the same as :SetText(tostring(nNumber))
. But this api is high performanced than :SetText
cause there is no intermediate string when concat string.
(
void
) ItemText:SetNumber(number
nNumber)
ItemText:SetNumber(213928)
Get text as pure number. Notice that this api is the same as tonumber(:GetText())
. But this api is high performanced than :SetText
cause there is no intermediate string when concat string.
(
number
nNumber) ItemText:GetNumber()
local nNumber = ItemText:GetNumber()
Set display text.
(
void
) ItemText:SetText(string
szText)
ItemText:SetText("This is a text.")
Get display text.
(
string
szText) ItemText:GetText()
local szText = ItemText:GetText()
Get the length of display text.
(
number
nLen) ItemText:GetTextLen()
local nLen = ItemText:GetTextLen()
Set text vertical alignment. Enum: 0-top
, 1-center
, 2-bottom
. Notice that you may need to call :FormatTextForDraw()
for apply the change and redraw text immediately.
(
void
) ItemText:SetVAlign(number
nAlign)
ItemText:SetVAlign(1)
Get text vertical alignment.
(
number
nAlign) ItemText:GetVAlign()
local nAlign = ItemText:GetVAlign()
Set text horizontal alignment. Enum: 0-left
, 1-middle
, 2-right
. Notice that you may need to call :FormatTextForDraw()
for apply the change and redraw text immediately.
(
void
) ItemText:SetHAlign(number
nAlign)
ItemText:SetHAlign(1)
Get text horizontal alignment.
(
number
nAlign) ItemText:GetHAlign()
local nAlign = ItemText:GetHAlign()
Set the spacing of two rows.
(
void
) ItemText:SetRowSpacing(number
nSpacing)
ItemText:SetRowSpacing(3)
Get the spacing of two rows.
(
number
nSpacing) ItemText:GetRowSpacing()
local nSpacing = ItemText:GetRowSpacing()
Set if this text control supports multiline display. Support multiline display means that when the width of the inner text reaches the width of the control, it will auto wrap.
(
void
) ItemText:SetMultiLine(bool
bMultiline)
ItemText:SetMultiLine(true)
Get if it supports multiline.
(
bool
bMultiline) ItemText:IsMultiLine()
local bMultiline = ItemText:IsMultiLine()
Format and redraw the text. When you change the style of text (such as alignment and row spacing), you need to call this api to apply style immediately.
(
void
) ItemText:FormatTextForDraw()
ItemText:FormatTextForDraw()
Auto set its width and height by its inner text.
(
void
) ItemText:AutoSize()
ItemText:AutoSize()
Set whether to keep center of each line in this text while drawing.
(
void
) ItemText:SetCenterEachLine(bool
bCenter)
ItemText:SetCenterEachLine(true)
Get whether to keep center of each line in this text while drawing.
(
bool
bCenter) ItemText:IsCenterEachLine()
local bCenter = ItemText:IsCenterEachLine()
Set the spacing between two characters.
(
void
) ItemText:SetFontSpacing(number
nSpacing)
ItemText:SetFontSpacing(5)
Get the spacing between two characters.
(
number
nSpacing) ItemText:GetFontSpacing()
local nSpacing = ItemText:GetFontSpacing()
Set whether this Text supports rich text.
(
void
) ItemText:SetRichText(bool
bRichText)
ItemText:SetRichText(true)
Get whether this Text supports rich text.
(
bool
bRichText) ItemText:IsRichText()
local bRichText = ItemText:IsRichText()
Get scale.
(
number
fScale) ItemText:GetFontScale()
local fScale = ItemText:GetFontScale()
Get scale. Notice that :Scale
is unavailable on Text control because drawing font is in a different way with drawing other controls.
(
void
) ItemText:SetFontScale(number
fScale)
ItemText:SetFontScale(2.0)
Set font id.
(
void
) ItemText:SetFontID(number
nFontID)
ItemText:SetFontID(1)
Set font color.
(
void
) ItemText:SetFontColor(number
nR,number
nG,number
nB)
ItemText:SetFontColor(255, 255, 0)
Set font border.
(
void
) ItemText:SetFontBorder(number
nBorderSize,number
nR,number
nG,number
nB)
ItemText:SetFontColor(1, 255, 255, 0)
Set font shadow.
(
void
) ItemText:SetFontShadow(number
nShadowOffset,number
nR,number
nG,number
nB)
ItemText:SetFontShadow(1, 255, 255, 0)
Get font id.
(
number
nFontID) ItemText:GetFontID()
local nFontID = ItemText:GetFontID()
Get font color.
(
number
nR,number
nG,number
nB) ItemText:GetFontColor()
local nR, nG, nB = ItemText:GetFontColor()
Get font border.
(
number
nBorderSize,number
nR,number
nG,number
nB) ItemText:GetFontBoder()
local nBorderSize, nR, nG, nB = ItemText:GetFontBoder()
Get font shadow. (I don't know why this api is not named as GetFontShadow
).
(
number
nShadowOffset,number
nR,number
nG,number
nB) ItemText:GetFontProjection()
local nShadowOffset, nR, nG, nB = ItemText:GetFontProjection()
Get the width and height of the inner text from offset 0 to nOffset
. If nOffset
equals with -1, the size of all text will be returned.
(
number
nW,number
nH) ItemText:GetTextExtent([number
nOffset])
local nW, nH = ItemText:GetTextExtent() -- Get all text size
local nW, nH = ItemText:GetTextExtent(3) -- Get text size from offset zero to three
Get the character offset of its inner text from a position offset (nOffset
). If nOffset
is not given, the count of all text will be returned.
(
number
nOffset) ItemText:GetTextPosExtent([number
nPosX])
local nCount = ItemText:GetTextPosExtent() -- Get the count of all of the text.
local nOffset = ItemText:GetTextPosExtent(80) -- Get the count of the text from offset zero to offset 80 pixels.