func_maxgui_tree views_createtreeview.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. .. _func_maxgui_tree views_createtreeview:
  2. ==============
  3. CreateTreeView
  4. ==============
  5. CreateTreeView -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. CreateTreeView:TGadget(x,y,w,h,group:TGadget,style=0)
  10. Create a TreeView gadget.
  11. A TreeView provides a view of an expandable list of nodes populated with the
  12. #AddTreeViewNode command. TreeView nodes can themselves contain nodes providing
  13. a flexible method of displaying a hierachy of information.
  14. [ @{Event ID} | @Description
  15. * EVENT_GADGETSELECT | The user has selected a node.
  16. * EVENT_GADGETACTION | The user has double-clicked a node.
  17. * EVENT_GADGETOPEN | The user has expanded a node to reveal its child nodes.
  18. * EVENT_GADGETCLOSE | The user has collapsed a node to hide its child nodes.
  19. * EVENT_GADGETMENU | The user has right-cliked somewhere in the TreeView.
  20. ]
  21. Each event will have the containing TreeView gadget as the event source and the concerned
  22. node gadget in the EventExtra field of the #TEvent.
  23. See Also: #AddTreeViewNode, #InsertTreeViewNode, #ModifyTreeViewNode, #TreeViewRoot,
  24. #SelectedTreeViewNode and #CountTreeViewNodes, #SelectTreeViewNode, #ExpandTreeViewNode,
  25. #CollapseTreeViewNode and #FreeTreeViewNode.
  26. Parameters
  27. ==========
  28. Return Values
  29. =============
  30. Nothing.
  31. Examples
  32. ========
  33. .. code-block:: blitzmax
  34. ' createtreeview.bmx
  35. Import MaxGui.Drivers
  36. Strict
  37. Local window:TGadget=CreateWindow("My Window",50,50,240,240)
  38. Local treeview:TGadget=CreateTreeView(0,0,200,200,window)
  39. SetGadgetLayout treeview,2,2,2,2
  40. Local root:TGadget=TreeViewRoot(treeview)
  41. Local help:TGadget=AddTreeViewNode("Help",root)
  42. AddTreeViewNode "topic 1",help
  43. AddTreeViewNode "topic 2",help
  44. AddTreeViewNode "topic 3",help
  45. Local projects:TGadget=AddTreeViewNode("Projects",root)
  46. AddTreeViewNode "project 1",projects
  47. AddTreeViewNode("project 2",projects)
  48. AddTreeViewNode("project 3 is a big waste of time",projects)
  49. While WaitEvent()
  50. Print CurrentEvent.ToString()
  51. Select EventID()
  52. Case EVENT_WINDOWCLOSE
  53. End
  54. End Select
  55. Wend
  56. See Also
  57. ========