rex_listCtrl
Plugin, ACE table, Discussion thread
Dependence: None
Dependence: None
Introduction
Manipulate instances of each line in a list.
Manipulate instances of each line in a list.
Concept
List is composed of some lines. Each line is composed of data and instances like sprites and texts.
The physical boundary of this list control plugin is a visible area of the list, other lines out of this area are invisible.
User creates instances of each visible line, and registers them to this plugin, then this plugin will set the position of these registered instances. And these registered instances will be destroyed while the line is invisible by this plugin automatically.
Properties of instances in a line are saved into this list control plugin instead of saving in private variables in the instances. So the instances only are used in displaying.
List is composed of some lines. Each line is composed of data and instances like sprites and texts.
The physical boundary of this list control plugin is a visible area of the list, other lines out of this area are invisible.
User creates instances of each visible line, and registers them to this plugin, then this plugin will set the position of these registered instances. And these registered instances will be destroyed while the line is invisible by this plugin automatically.
Properties of instances in a line are saved into this list control plugin instead of saving in private variables in the instances. So the instances only are used in displaying.
On a line is visible
"Condition:On line visible" will be triggered while the line becomes visible. Create instances of this line under this event. There are some expressions for this line -
"Condition:On line visible" will be triggered while the line becomes visible. Create instances of this line under this event. There are some expressions for this line -
Expression:LineIndex - the index of this visible line
( Expression:LineTLX, Expression:LineTLY ) - the position of the line's top-left point
Then use "Action:Pin instance" to pin instances at this line.
On a line is invisible
"Condition:On line invisible" will be triggered while a line becomes invisible. Pinned instances will be destroyed automatically.
The line index could be got by "Expression:LineIndex".
"Condition:On line invisible" will be triggered while a line becomes invisible. Pinned instances will be destroyed automatically.
The line index could be got by "Expression:LineIndex".
Retrieve visible lines
Retrieve visible lines by "Condition:For each visible line", get the line index by "Expression:LineIndex" and the position of the line's top-left point by ( Expression:LineTLX, Expression:LineTLY ) under this event.
Retrieve visible lines by "Condition:For each visible line", get the line index by "Expression:LineIndex" and the position of the line's top-left point by ( Expression:LineTLX, Expression:LineTLY ) under this event.
Get line index
Call "Expression:UID2LineIndex" to get the pinned instance is belong to which line.
Call "Expression:UID2LineIndex" to get the pinned instance is belong to which line.
Pick pined instances
"Condition:Pick instances", "Action:Pick instance", or "Condition:Pick all instances", "Action:Pick all instances" could be used to pick pined instances on a line.
"Condition:Pick instances", "Action:Pick instance", or "Condition:Pick all instances", "Action:Pick all instances" could be used to pick pined instances on a line.
Data of each line
Data of each line is stored in other data structure, like official array, official dictionary, rex_csv, etc... which indexes by line index.
Properties of instances (for example, "is selected" state in a sprite) in each line is stored/read in custom data of this plugin by "Action:Set value"/"Expression:At".
It is better NOT to use private variable to save properties in these instances in a line, because that instances in a line will be destroyed when the line is invisible.
Data of each line is stored in other data structure, like official array, official dictionary, rex_csv, etc... which indexes by line index.
Properties of instances (for example, "is selected" state in a sprite) in each line is stored/read in custom data of this plugin by "Action:Set value"/"Expression:At".
It is better NOT to use private variable to save properties in these instances in a line, because that instances in a line will be destroyed when the line is invisible.
Retrieve filter lines
"Condition:For each matched line" could be used to retrieve lines which the value in custom data is matched the condition. Get the line index by "Expression:LineIndex".
"Condition:For each matched line" could be used to retrieve lines which the value in custom data is matched the condition. Get the line index by "Expression:LineIndex".
Scroll list
The list is scrolled by an offset y, which is the (top-left) position of line index 0. Call one of these actions to set the offset y -
The list is scrolled by an offset y, which is the (top-left) position of line index 0. Call one of these actions to set the offset y -
- Action:Set
- Action:Add to
- Action:Scroll to index
- Action:Scroll by percentage
Clamp offset y
Set "Clamp OY" to "Yes" could clamp the visible line between first to last line.
Set to "No" if user wants to control the offset y without any default constraint.
Set "Clamp OY" to "Yes" could clamp the visible line between first to last line.
Set to "No" if user wants to control the offset y without any default constraint.
Total lines
Set total lines count in "Total lines" in properties table, or set by "Action:Set total lines count".
Set total lines count in "Total lines" in properties table, or set by "Action:Set total lines count".
Retrieve lines
"Condition:For each line" could retrieve each line in the list, or use "Condition:For each line in a range" to retrieve some lines.
Get the line index by "Expression:LineIndex".
"Condition:For each line" could retrieve each line in the list, or use "Condition:For each line in a range" to retrieve some lines.
Get the line index by "Expression:LineIndex".
Line height
Sample capx
Default line height is set in "Line height" in properties table, or set by "Action:Set default line height" for each line.
Calls "Action:Set line height" to set line height of a specific line, read line height back by "Expression:LineHeight".
Sample capx
Default line height is set in "Line height" in properties table, or set by "Action:Set default line height" for each line.
Calls "Action:Set line height" to set line height of a specific line, read line height back by "Expression:LineHeight".
Refresh visible lines
Call "Action:Refresh" to refresh visible lines by these steps
Call "Action:Refresh" to refresh visible lines by these steps
- Set all visible lines to invisible, it will destroy all instances in current visible lines.
- Get visible lines. it will create all instances in these new visible lines.
List height
Get list height by "Expression:ListHeight".
Get list height by "Expression:ListHeight".
Remove lines
Call "Action:Remove lines" to remove lines from a start index. It will also destroy instances which belong these removed lines.
The custom data of these removed lines will also be removed, and packed into a string which could be read by "Expression:LastRemovedLines". It could be used to insert to another list, see next section.
Call "Action:Remove lines" to remove lines from a start index. It will also destroy instances which belong these removed lines.
The custom data of these removed lines will also be removed, and packed into a string which could be read by "Expression:LastRemovedLines". It could be used to insert to another list, see next section.
Insert lines
Call "Action:Insert new lines" or "Action:Push new lines" to insert some new lines with empty custom data.
Or call "Action:Insert lines" or "Action:Push lines" to insert some new lines with packed custom data. Packed custom data might come from "Expression:CustomDataInLines" or "Expression:LastRemovedLines".
Call "Action:Insert new lines" or "Action:Push new lines" to insert some new lines with empty custom data.
Or call "Action:Insert lines" or "Action:Push lines" to insert some new lines with packed custom data. Packed custom data might come from "Expression:CustomDataInLines" or "Expression:LastRemovedLines".
Move lines from one list to another
Sample capx
Here is a solution to move lines from source list to target list:
Sample capx
Here is a solution to move lines from source list to target list:
- Insert data to another data structure (official array object in this sample), and insert the custom data of these lines by "Expression:CustomDataInLines" to target list.
- Remove data and lines of list from source list.
Destroy
All pined object in each line would be destroyed while listCtrl object had been destroyed by action:Destroy.
All pined object in each line would be destroyed while listCtrl object had been destroyed by action:Destroy.
Scrolling horizontal
Sample capx
Set "Axis" to "Horizontal" in properties table to scroll lines horizontally.
Sample capx
Set "Axis" to "Horizontal" in properties table to scroll lines horizontally.