CWinCtrlLog¶
Script: LOG
This is the control to display a chat log.
It has contents of the same number as the number of rows.
Unlike the list box , the maximum number of contents can be set. If it is added more than the maximum number , the contents is circulated and it is reused(The oldest log is overwritten).
LOGTEXT and other kind of controls can also be included as contents.
Callbacks arriving at :class:`CWindowBase<CWindowBase>`
void onDrag(CWinCtrlBase cCtrl,Vector2 pos,Vector2 dragVelocity)
Called when you scroll . Even if you lock the scroll , this callback is called .
void onDrop(CWinCtrlBase cCtrl,CWindowBase cDragWindow,CWinCtrlBase cDragCtrl)
-
class CWinCtrlLog
¶ Functions / Properties
-
void
resize
(Int32 count)¶ - Param int count
Log’s size
Listbox returns the number of contents, while Log is the maximum number of logs that can be kept.
-
Int32
count
{ get; }¶ For Listbox it is the number of content in the content list, but for Log it is the number of logs it have.
It is never greater than the value set in resize.
-
void
clearLog
()¶ Clears all currently held logs and empties them.
-
CWinCtrlLogText
add
(String text, WinColor color)¶ - Param string text
Text to add
- Param WinColor color
Text color
- Return CWinCtrlLogText
Log text control with string
To add a log, you first add content internally (or reuse it).
Finds the CWinCtrlLogText in its content and sets the text and color specified for the control’s caption.
You can get the added content from the returned CWinCtrlLogText.
CWinCtrlLogText ltChat = lgChat.add(strSentence,WinColor.white); //Access to content that contains the added LogText. CWinContents contents = ltChat.parent;
-
Vector2
viewsize
{ get; set; }¶ It is the size of the list box.It is equivalent to the size property.
-
Vector2
screensize
{ get; set; }¶ It is the size of the list box virtual screen.This value is the sum of all heights in the content list.
-
Vector2
offset
{ get; set; }¶ This value represents where the list box is pointing in the virtual screen. Set a value to move there instantly.If you want to move the animation smoothly,you can use
setSmoothOffset
.
-
void
setSmoothOffset
(Vector2 offset, Single spd)¶ - Param Vector2 offset
Final offset you want to set
- Param float spd
Veloccity
-
Vector2
smoothOffset
{ get; set; }¶ It behaves the same as calling
setSmoothOffset
at the speed of 0.25 .
-
Boolean
isSmoothScrolled
{ get; }¶ You can check this value with to see if you are during setSmoothOffset scrolling animation.
-
Vector2
getContentsOffset
(Int32 index, e_Anchor eAnchor)¶ - Param int index
Index of the content offset you want to get.
- Param e_Anchor eAnchor
Specify where you want the content to be placed with the anchor
Specify where you want the content to be placed with the anchor.
If the contents of the list box are arranged in a horizontal direction
e_Anchor
Location
Bottom,LeftBottom,RightBottom
Offset value for the contents to be aligned with the bottom of the view.
Top,LeftTop,RightTop
Offset value for the contents to be aligned with the top of the view
Center,Left,Right
Offset value for the contents to be aligned with the center of the view
If the contents of the list box are arranged in a horizontal direction
e_Anchor
Location
Left,LeftBottom,LeftTop
Offset value for the contents to be aligned with the left of the view
Right,RightBottom,RightTop
Offset value for the contents to be aligned with the right of the view
Center,Top,Bottom
Offset value for the contents to be aligned with the center of the view
-
void
Example of use
CWinCtrlLog lgChat = find<CWinCtrlLog>(LOG_Chat);
lgChat.resize(10);
string strSentence;
CWinCtrlLogText ltChat = lgChat.add(strSentence,WinColor.white);
CWinContents contents = ltChat.parent;
How to clear log.
//log clear
lgChat.clearLog();