JRowe Posted May 27, 2008 Posted May 27, 2008 #include <GUIConstants.au3> #include <GuiListView.au3> $Form1 = GUICreate("Form1", 301, 324, 193, 125) $TreeView2 = GUICtrlCreateTreeView(160, 16, 121, 297) GuiCtrlSetState(-1,$GUI_DROPACCEPTED) $ListView1 = GUICtrlCreateListView("", 8, 16, 130, 297, BitOR($LVS_LIST,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS)) $ListView1_0 = GUICtrlCreateListViewItem("blahblah", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("1", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("2", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("3", $ListView1) $ListView1_4 = GUICtrlCreateListViewItem("4", $ListView1) $ListView1_5 = GUICtrlCreateListViewItem("5", $ListView1) $ListView1_6 = GUICtrlCreateListViewItem("6", $ListView1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $handle = GUICtrlGetHandle($ListView1) $HotItem = _GUICtrlListView_GetHotItem ($handle) $AddToTreeView = _GUICtrlListView_GetItemText($handle, $HotItem) GUICtrlCreateTreeViewItem ($AddToTreeView, $TreeView2) EndSwitch WEnd Very simple interface to allow you to drag items from a listview onto a treeview. Now here's the hard part... how do I set up the treeview to accept subitems? expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> #include <GuiTreeView.au3> $Form1 = GUICreate("Form1", 301, 324, 193, 125) $TreeView2 = GUICtrlCreateTreeView(160, 16, 121, 297) GuiCtrlSetState(-1,$GUI_DROPACCEPTED) $ListView1 = GUICtrlCreateListView("", 8, 16, 130, 297, BitOR($LVS_LIST,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS)) $ListView1_0 = GUICtrlCreateListViewItem("blahblah", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("1", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("2", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("3", $ListView1) $ListView1_4 = GUICtrlCreateListViewItem("4", $ListView1) $ListView1_5 = GUICtrlCreateListViewItem("5", $ListView1) $ListView1_6 = GUICtrlCreateListViewItem("Add as a SubItem", $ListView1) GUISetState(@SW_SHOW) $handle = GUICtrlGetHandle($ListView1) $TVhandle = GUICtrlGetHandle($TreeView2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $HotItem = _GUICtrlListView_GetHotItem ($handle) $AddToTreeView = _GUICtrlListView_GetItemText($handle, $HotItem) Switch $AddToTreeView Case $AddToTreeView = "Add as a SubItem" $TVHotItem = 1 _GUICtrlTreeView_AddChild($TVHandle, $TVHotItem, $AddToTreeView) Case Else GUICtrlCreateTreeViewItem ($AddToTreeView, $TreeView2) EndSwitch EndSwitch WEnd I'm trying to use _GUICtrlTreeView_AddChild as the method of adding a subitem. I could be way off, here, though. Anyone have any ideas? [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now