CWinCtrlListbox¶
Script: LISTBOX
This is the control for the list box.
It has contents of the same number as the number of rows.
It can have a lot of contents as long as the remaining memory.
Not only the list box that is lined with content in the vertical direction , it is possible to arrange also in the horizontal direction .
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 CWinCtrlListBox
¶ Functions / Properties
-
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
.This value determines whether the user is swiping.
-
void
setSmoothOffset
(Vector2 offset, Single spd)¶ - Param Vector2 offset
Final offset you want to set
- Param float spd
Veloccity
-
Vector2
smoothOffset
{ get; set; }¶
Veloccity
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
-
Vector2
Example of use
override public void onUpdate() {
// get control
CWinCtrlListbox lbFriends = find<CWinCtrlListbox>(LISTBOX_Friends);
// set list box contents num.
lbFriends.resize(10);
// Refresh the status in a list box (In this case, 10 lines will be updated.)
for (int i = 0;i < lbFriends.Count;++i) {
// Get a single line of list box content.
CWinContents contents = lbFriends.getContentsFromIndex(i);
//Get BUTTON(Name)
CWinCtrlButton btnName = contents.find<CWinCtrlButton>(BUTTON_Name);
//Get ICON(Icon)
CWinCtrlIcon icnName = contents.find<CWinCtrlIcon>(ICON_Icon);
}
}