Rapid-Q Documentation by William Yu (c)1999 | Appendix A: QTREEVIEW |
|
TYPE TreeNodeType '' ie. TreeView.Item(0).Text Text AS STRING ImageIndex AS INTEGER StateIndex AS INTEGER SelectedIndex AS INTEGER Count AS INTEGER '' Read only Level AS INTEGER '' Read only IsVisible AS INTEGER '' Read only Handle AS INTEGER '' Read only HasChildren AS INTEGER Selected AS INTEGER END TYPEQTreeView Properties
Field | Type | R/W | Default |
|
|
|
|
Align | INTEGER | RW | alNone |
BorderStyle | INTEGER | RW | bsSingle |
Color | INTEGER | RW | |
Cursor | INTEGER | RW | crDefault |
Enabled | INTEGER | RW | True |
Font | QFONT | W | |
Handle | INTEGER | RW | |
Height | INTEGER | RW | |
HideSelection | INTEGER | RW | False |
Hint | STRING | RW | |
Images | QIMAGELIST | W | |
Indent | INTEGER | RW | 19 |
Item | ARRAY of TreeNodeType | RW | |
ItemCount | INTEGER | RW | |
ItemIndex | INTEGER | RW | |
Left | INTEGER | RW | 0 |
Parent | QFORM/QPANEL/QTABCONTROL | W | |
PopupMenu | QPOPUPMENU | W | |
ReadOnly | INTEGER | RW | False |
ShowButtons | INTEGER | RW | True |
ShowHint | INTEGER | RW | False |
ShowLines | INTEGER | RW | True |
ShowRoot | INTEGER | RW | True |
SortType | INTEGER | RW | stText |
StateImages | QIMAGELIST | W | |
TabOrder | INTEGER | RW | |
Tag | INTEGER | RW | |
Top | INTEGER | RW | 0 |
TopIndex | INTEGER | RW | |
Width | INTEGER | RW | |
Visible | INTEGER | RW | True |
Method | Type | Description | Params |
|
|
|
|
AddItems | SUBI | Add items to treeview | STRING, Infinite |
AddChildItems | SUB (Index%, S1$, S2$, ...) | Add child item at Index% | Minimum 2 |
Clear | SUB | Clear all items in treeview | 0 |
Collapse | SUB (Index%, Recurse%) | Collapses node | 2 |
DelItems | SUBI | Delete items from treeview | INTEGER, Infinite |
Expand | SUB (Index%, Recurse%) | Expand node, revealing its childs | 2 |
FullCollapse | SUB | Collapses all nodes | 0 |
FullExpand | SUB | Expands all nodes | 0 |
GetItemAt | FUNCTION (X%, Y%) AS LONG | Get the index node at X,Y | 2 |
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2 |
LoadFromFile | SUB (Filename AS STRING) | Load items from file | 1 |
SaveToFile | SUB (Filename AS STRING) | Save items to file | 1 |
Sort | SUB | Sort all items from A-Z | 0 |
Event | Type | Occurs when... | Params |
|
|
|
|
OnClick | VOID | TreeView was clicked on | 0 |
OnChange | SUB (Index%) | Selection (not modification) has changed from one item to another | 1 |
OnChanging | SUB (Index%, AllowChange%) | Selection is about to be changed | 2 |
OnCollapse | SUB (Index%) | Just after a node has been collapsed | 1 |
OnCollapsing | SUB (Index%, AllowCollapse%) | A node is about to be collapsed | 2 |
OnDblClick | VOID | TreeView was double clicked on | 0 |
OnDeletion | SUB (Index%) | A node in the tree is deleted | 1 |
OnEdited | SUB (Index%, BYREF S$) | After the user edits a text of a node | 2 |
OnEditing | SUB (Index%, AllowEdit%) | The user starts to edit the text | 2 |
OnExpand | SUB (Index%) | After a node is expanded | 1 |
OnExpanding | SUB (Index%, AllowExpansion%) | A node is about to be expanded | 2 |
OnGetImageIndex | SUB (Index%) | The treeview looks up the ImageIndex of a node | 1 |
OnGetSelectedIndex | SUB (Index%) | The treeview looks up the SelectedIndex of a node | 1 |
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2 |
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 |
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2 |
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 |
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 |
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 |
'' Tree view example, hot tracking through items SUB TreeViewChange (Node AS INTEGER, AllowChange AS INTEGER, Sender AS QTREEVIEW) IF Node = 8 THEN AllowChange = 0 END SUB SUB TreeViewMouseMove (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, Sender AS QTREEVIEW) I = Sender.GetItemAt(X,Y) IF I >= 0 THEN Sender.ItemIndex = I END SUB CREATE Form AS QFORM Center CREATE TreeView AS QTREEVIEW Align = 5 AddItems "1","2","3" AddChildItems 0, "Sub 1", "Sub 2", "Sub 3" AddChildItems 4, "Sub 1", "Sub 2", "Sub 3" FullExpand OnChanging = TreeViewChange OnMouseMove = TreeViewMouseMove END CREATE END CREATE '-- No real purpose, just change all items FOR I = 0 TO TreeView.ItemCount-1 TreeView.Item(I).Text = STR$(I) NEXT Form.ShowModal