JellyFish666 Posted November 30, 2008 Share Posted November 30, 2008 (edited) I always hated treeview in my script but I must add one and since I have never been good with them or seen no use for them I avoided them as much as possible, but now I need it but have no clue what to do. The problem is the treeview I must add in my script is for the user to change the treeview but not sure how I can go about doing this without using variables for the trees and the child trees. I think I need something sort of like this except instead of reading the "Child Input Box" it would be a "Child Edit Box" having trouble splitting the data and plotting it into the treeview. I also would like to know how to fix this script when you hit add the first one it builds doesn't have the + button and I know why it is doing that it because the Parent of the treeview isn't build yet but whats the best way of going about fixing it. I am tired and my heads been hurting all day so can't really think #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> $Test = GUICreate("Test", 250, 250) $Tree = GUICtrlCreateTreeView(0, 0, 250, 195) $Name = GUICtrlCreateInput("Tree Name" , 0 , 200 , 125 , 25) $Child = GUICtrlCreateInput("Tree Child" , 125 , 200 , 125 , 25) $Add = GUICtrlCreateButton("Add" , 0 , 225 , 250 , 25) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Add _UpdateTree(GUICtrlRead($Name) , GUICtrlRead($Child)) EndSwitch WEnd Func _UpdateTree($TreeName , $TreeChild) $TreeView = GUICtrlCreateTreeViewItem($TreeName, $Tree) GUICtrlCreateTreeViewItem($TreeChild, $TreeView) EndFunc well I am at it is there a way to read a inputbox and a edit box of data and see if they are exactly the same This is my edit box hi hello Thanks Welcome and say my input box is searching for the word "Thanks" so it will be found by reading the edits box buffer. Edited November 30, 2008 by JellyFish666 Link to comment Share on other sites More sharing options...
GEOSoft Posted November 30, 2008 Share Posted November 30, 2008 (edited) I always hated treeview in my script but I must add one and since I have never been good with them or seen no use for them I avoided them as much as possible, but now I need it but have no clue what to do. The problem is the treeview I must add in my script is for the user to change the treeview but not sure how I can go about doing this without using variables for the trees and the child trees. I think I need something sort of like this except instead of reading the "Child Input Box" it would be a "Child Edit Box" having trouble splitting the data and plotting it into the treeview. I also would like to know how to fix this script when you hit add the first one it builds doesn't have the + button and I know why it is doing that it because the Parent of the treeview isn't build yet but whats the best way of going about fixing it. I am tired and my heads been hurting all day so can't really think #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> $Test = GUICreate("Test", 250, 250) $Add = GUICtrlCreateButton("Add" , 0 , 225 , 250 , 25) $Name = GUICtrlCreateInput("Tree Name" , 0 , 200 , 125 , 25) $Child = GUICtrlCreateInput("Tree Child" , 125 , 200 , 125 , 25) $Tree = GUICtrlCreateTreeView(0, 0, 250, 195) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Add _UpdateTree(GUICtrlRead($Name) , GUICtrlRead($Child)) EndSwitch WEnd Func _UpdateTree($TreeName , $TreeChild) $TreeView = GUICtrlCreateTreeViewItem($TreeName, $Tree) GUICtrlCreateTreeViewItem($TreeChild, $TreeView) EndFunc well I am at it is there a way to read a inputbox and a edit box of data and see if they are exactly the same This is my edit box hi hello Thanks Welcome and say my input box is searching for the word "Thanks" so it will be found by reading the edits box buffer.Might be easier for you to understand it you rename a couple of the variables and reverse the order you pass them to the function. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> $Test = GUICreate("Test", 250, 250) $Add = GUICtrlCreateButton("Add" , 0 , 225 , 250 , 25) $Name = GUICtrlCreateInput("Tree Parent" , 0 , 200 , 125 , 25) $Child = GUICtrlCreateInput("Tree Child" , 125 , 200 , 125 , 25) $Tree = GUICtrlCreateTreeView(0, 0, 250, 195) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Add _UpdateTree( GUICtrlRead($Child), GUICtrlRead($Name) ) EndSwitch WEnd Func _UpdateTree($hChild , $hParent) ;; Here we just create a variable name for the item so you can refer to it later $sDisp = "Tvi_" & StringReplace($hChild, Chr(32), "_");;No spaces allowed in variable names so we replace them with _ ; Here we assign the name to the TVItem and make it Global Assign($sDisp, GUICtrlCreateTreeViewItem($hChild, $hParent), 1) EndFunc Edited November 30, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
JellyFish666 Posted November 30, 2008 Author Share Posted November 30, 2008 (edited) Might be easier for you to understand it you rename a couple of the variables and reverse the order you pass them to the function. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> $Test = GUICreate("Test", 250, 250) $Add = GUICtrlCreateButton("Add" , 0 , 225 , 250 , 25) $Name = GUICtrlCreateInput("Tree Parent" , 0 , 200 , 125 , 25) $Child = GUICtrlCreateInput("Tree Child" , 125 , 200 , 125 , 25) $Tree = GUICtrlCreateTreeView(0, 0, 250, 195) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Add _UpdateTree( GUICtrlRead($Child), GUICtrlRead($Name) ) EndSwitch WEnd Func _UpdateTree($hChild , $hParent) ;; Here we just create a variable name for the item so you can refer to it later $sDisp = "Tvi_" & StringReplace($hChild, Chr(32), "_");;No spaces allowed in variable names so we replace them with _ ; Here we assign the name to the TVItem and make it Global Assign($sDisp, GUICtrlCreateTreeViewItem($hChild, $hParent), 1) EndFunc I am just wondering does this example actually work or is it for me to study, because I can't seem to get it to do anything, anyways I am going to go to bed now thanks for the help. If possible is there a way to do this without using variables. also can you have a picture background treeview I made one sort of but its buggy. Edited November 30, 2008 by JellyFish666 Link to comment Share on other sites More sharing options...
GEOSoft Posted November 30, 2008 Share Posted November 30, 2008 I am just wondering does this example actually work or is it for me to study, because I can't seem to get it to do anything, anyways I am going to go to bed now thanks for the help.If possible is there a way to do this without using variables.also can you have a picture background treeview I made one sort of but its buggy.I was in bed when I wrote it and it was just an example. Didn't work because I left out a very important line.Give me time for a few cups of coffee and I'll revisit this. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
JellyFish666 Posted November 30, 2008 Author Share Posted November 30, 2008 (edited) I was in bed when I wrote it and it was just an example. Didn't work because I left out a very important line. Give me time for a few cups of coffee and I'll revisit this. Thanks, I got what I want working now, but it there a better way of splitting them? Func _UpdateTree($TreeName , $TreeChild) ;$TreeView = GUICtrlCreateTreeViewItem($TreeName, $Tree) ;GUICtrlCreateTreeViewItem($TreeChild, $TreeView) $Split = StringSplit($TreeChild , " ") $i = 1 If $Split[$i] = "" Then MsgBox(0 , "Error" , "Incorrect Link: Please make sure your link is in this format" & @CRLF & @CRLF & "test") ElseIf Not StringInStr($Split[$i] , "test") Then MsgBox(0 , "Error" , "Incorrect Link: Please make sure your link is in this format" & @CRLF & @CRLF & "test") Else $TreeView = GUICtrlCreateTreeViewItem($TreeName, $Tree) Do If $i = 1 Then GUICtrlCreateTreeViewItem($Split[$i] , $TreeView) Else GUICtrlCreateTreeViewItem(StringTrimLeft($Split[$i] , 2), $TreeView) EndIf $i = $i +1 Until $i = $Split[0] EndIf EndFunc Edited November 30, 2008 by JellyFish666 Link to comment Share on other sites More sharing options...
GEOSoft Posted November 30, 2008 Share Posted November 30, 2008 You will really have to give more details of your code. Here is some working code that does what you asked in the first place. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <GuiTreeView.au3> $Test = GUICreate("Test", 250, 280) $Add = GUICtrlCreateButton("Add" , 0 , 250 , 250 , 25) $Lbl_Name = GUICtrlCreateLabel("Tree Parent", 0, 200, 125, 20, 1) $Name = GUICtrlCreateInput("" , 0 , 220 , 125 , 25) $Lbl_Child = GUICtrlCreateLabel("Tree Child", 125, 200, 125, 20, 1) $Child = GUICtrlCreateInput("" , 125 , 220 , 125 , 25) $Tree = GUICtrlCreateTreeView(0, 0, 250, 195) $Dummy = GUICtrlCreateDummy() GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Add _UpdateTree( GUICtrlRead($Child), GUICtrlRead($Name) ) Case $Tree to $Dummy GUICtrlSetData($Name, ControlTreeView($Test,"", $Tree, "GetSelected")) EndSwitch WEnd Func _UpdateTree($hChild , $hParent) Local $sDisp = "Tvi_" & StringReplace($hChild, Chr(32), "_");;No spaces allowed in variable names so we replace them with _ If $hParent = "" Then $hParent = $Tree Assign($sDisp, GUICtrlCreateTreeViewItem($hChild, $hParent), 1) Else $hParent = _GUICtrlTreeView_FindItem($Tree, $hParent) _GUICtrlTreeView_BeginUpdate($Tree) Assign($sDisp, _GUICtrlTreeView_AddChild($Tree, $hParent, $hChild), 1) _GUICtrlTreeView_EndUpdate($Tree) EndIf $dummy = GUICtrlCreateDummy() EndFunc ;<==> _UpdateTree() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
JellyFish666 Posted December 1, 2008 Author Share Posted December 1, 2008 Thanks. Link to comment Share on other sites More sharing options...
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