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 |
QTreeView Examples
'' 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