home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 February / PCWorld_2006-02_cd.bin / software / vyzkuste / triky / triky.exe / autoit-v3-setup.exe / Examples / GUICtrlCreateTreeViewItem.au3 < prev    next >
Text File  |  2005-01-13  |  2KB  |  55 lines

  1. #include <GUIConstants.au3>
  2.  
  3. GUICreate("My GUI with treeview",350,212)
  4.  
  5. $treeview = GUICtrlCreateTreeView (6,6,100,150,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)
  6. $generalitem = GUICtrlCreateTreeViewitem ("General",$treeview)
  7. $displayitem = GUICtrlCreateTreeViewitem ("Display",$treeview)
  8. $aboutitem = GUICtrlCreateTreeViewitem ("About",$generalitem)
  9. $compitem = GUICtrlCreateTreeViewitem ("Computer",$generalitem)
  10. $useritem = GUICtrlCreateTreeViewitem ("User",$generalitem)
  11. $resitem = GUICtrlCreateTreeViewitem ("Resolution",$displayitem)
  12. $otheritem = GUICtrlCreateTreeViewitem ("Other",$displayitem)
  13.  
  14. $startlabel = GUICtrlCreateLabel ("TreeView Demo",190,90,100,20)
  15. $aboutlabel = GUICtrlCreateLabel ("This little scripts demonstates the using of a treeview-control.",190,70,100,60)
  16. GUICtrlSetState(-1,$GUI_HIDE)
  17. $compinfo = GUICtrlCreateLabel ("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack,120,30,200,80)
  18. GUICtrlSetState(-1,$GUI_HIDE)
  19.  
  20. $okbutton = GUICtrlCreateButton ("OK",100,185,70,20)
  21. $cancelbutton = GUICtrlCreateButton ("Cancel",180,185,70,20)
  22.  
  23. GUISetState ()
  24. While 1
  25.     $msg = GUIGetMsg()
  26.     Select
  27.         Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
  28.             ExitLoop
  29.     
  30.         Case $msg = $generalitem
  31.             GUIChangeItems($aboutlabel,$compinfo,$startlabel,$startlabel)
  32.         
  33.         Case $msg = $aboutitem
  34.             GUICtrlSetState ($compinfo,$GUI_HIDE)
  35.             GUIChangeItems($startlabel,$startlabel,$aboutlabel,$aboutlabel)
  36.             
  37.         Case $msg = $compitem
  38.             GUIChangeItems($startlabel,$aboutlabel,$compinfo,$compinfo)
  39.     EndSelect
  40. WEnd
  41.  
  42. GUIDelete()
  43. Exit
  44.  
  45. Func GUIChangeItems($hidestart,$hideend,$showstart,$showend)
  46.     Local $idx,$hidestart,$hideend,$showstart,$showend
  47.     
  48.     For $idx = $hidestart To $hideend
  49.         GUICtrlSetState ($idx,$GUI_HIDE)
  50.     Next
  51.     For $idx = $showstart To $showend
  52.         GUICtrlSetState ($idx,$GUI_SHOW)
  53.     Next    
  54. EndFunc
  55.