RTFC Posted April 4, 2016 Posted April 4, 2016 @maniootek: Melba is not around this week, so you may have to wait a while for a reply. Just so you know. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O
Moderators Melba23 Posted April 5, 2016 Author Moderators Posted April 5, 2016 maniootek, You can very easily write a small function to convert an array to a suitably formatted string which the UDF will accept: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include "GUITreeViewEx.au3" Global $aTV_List_1[9][3] = [ _ ["Food", "Fruit", "Apple"], _ ["Food", "Meat", "Steak"], _ ["Food", "Meat", "Chicken"], _ ["Food", "Dairy", "Cheese"], _ ["Drinks", "Water"], _ ["Drinks", "Fizzy", "Cola"], _ ["Drinks", "Juice", "Orange"], _ ["Drinks", "Hot Drinks", "Tea"], _ ["Drinks", "Hot Drinks", "Coffee"]] $sTV_Data_1 = _ConvertArray($aTV_List_1) Global $aTV_List_2[8][3] = [ _ ["A", "AA", "AAA"], _ ["A", "AA", "AAB"], _ ["B", "BA"], _ ["B", "BB", "BBA"], _ ["B", "BB", "BBB"], _ ["B", "BB", "BBC"], _ ["C", "CA"], _ ["D", "DA", "DAA"]] $sTV_Data_2 = _ConvertArray($aTV_List_2) ; Create GUI Global $hGUI = GUICreate("Test", 500, 500) ; Create TreeView Global $cTV_1 = GUICtrlCreateTreeView(10, 10, 230, 350, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_CHECKBOXES)) _GUITreeViewEx_LoadTV($cTV_1, $sTV_Data_1) ; Expand TreeView _GUICtrlTreeView_Expand($cTV_1) Global $cTV_2 = GUICtrlCreateTreeView(260, 10, 230, 350, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_CHECKBOXES)) _GUITreeViewEx_LoadTV($cTV_2, $sTV_Data_2) ; Expand TreeView _GUICtrlTreeView_Expand($cTV_2) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _ConvertArray($aTV_List) $sString = "" $iColCount = UBound($aTV_List, 2) Local $aCurrLevel[$iColCount] For $i = 0 To UBound($aTV_List) - 1 For $j = 0 To $iColCount - 1 If $aTV_List[$i][$j] <> "" And $aTV_List[$i][$j] <> $aCurrLevel[$j] Then $aCurrLevel[$j] = $aTV_List[$i][$j] $sString &= _StringRepeat("~", $j) & $aTV_List[$i][$j] & "|" EndIf Next Next Return StringTrimRight($sString, 1) EndFunc But I am not adding that wrapper function to the UDF or I will have to write a conversion function for every imaginable data format. If the user does not like my chosen format for the TreeView loading string then it is up to them to write a wrapper to convert their desired format into the one used by the UDF. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
maniootek Posted April 7, 2016 Posted April 7, 2016 (edited) Thank you for your answer. I think this could be most universal function for populating tree view from array. Anyway, I have started to use your UDF and sometimes when I click on any place on tree view area i got this error: is it common problem? I have created sample of my code when this error show up: #include <Array.au3> #include "GUITreeViewEx.au3" $gui = GUICreate("Form1", 343, 520);, 1565, 583) $button = GUICtrlCreateButton("Populate", 248, 8, 81, 41) $TreeView1 = GUICtrlCreateTreeView(10, 96, 250, 300, BitOR($GUI_SS_DEFAULT_TREEVIEW,$TVS_CHECKBOXES)) GUISetState(@SW_SHOW) _GUITreeViewEx_RegMsg() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 ;$GUI_EVENT_CLOSE Exit Case $button $fill = "Food|~Fruit|~~Apple|~Meat|~~Steak|~~#Chicken|~Dairy|~~Cheese|Drinks|~Water|~Fizzy|~~#Cola|~Juice|~~Orange|~Hot Drinks|~~Tea|~~Coffee" PopulateTreeView($fill) EndSwitch _GUITreeViewEx_AutoCheck() WEnd Func PopulateTreeView($sTreeViewFill) _GUICtrlTreeView_DeleteAll($TreeView1) _GUITreeViewEx_LoadTV($TreeView1, $sTreeViewFill) _GUICtrlTreeView_Expand($TreeView1) _GUITreeViewEx_InitTV($TreeView1) EndFunc I have tried to create script based on your example "GUITreeViewEx_Example_Loop.au3" any idea what's wrong? Edit: I have noticed that problem occur when i press the buttons more than 1 time (pupulatetreeview) Edited April 9, 2016 by maniootek
maniootek Posted April 11, 2016 Posted April 11, 2016 I think I found the problem. I just simple forgot to use _GUITreeViewEx_CloseTV function after use _GUICtrlTreeView_DeleteAll and before I use _GUITreeViewEx_LoadTV with new data.
Moderators Melba23 Posted April 14, 2016 Author Moderators Posted April 14, 2016 maniootek, Yes, that is the solution. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
maniootek Posted April 14, 2016 Posted April 14, 2016 This problem still happens sometimes, I don't know why.
Moderators Melba23 Posted April 14, 2016 Author Moderators Posted April 14, 2016 maniootek, I have been trying to reproduce the problem without any success. Unless you can provide me with a reproducible series of actions to get the error I am afraid I cannot really do any debugging. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
gillesg Posted January 29, 2018 Posted January 29, 2018 (edited) All, Great UDF once again. For my need, i merged the three state treeview with this UDF. Fos those interested here is the result. GUITreeView 3 state.7z Edited January 29, 2018 by gillesg
joiner Posted January 21, 2019 Posted January 21, 2019 thank you melba23 your idea helped implemented a single selection of sub items code is far from ideal like my english)) TreeViewRCH.7z
Moderators Melba23 Posted January 21, 2019 Author Moderators Posted January 21, 2019 joiner, Delighted you find the UDF useful. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted January 28, 2019 Author Moderators Posted January 28, 2019 MattHiggs, Your posts concerning ListViews have been split off and can been found here. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
mike1950r Posted May 12 Posted May 12 (edited) Hi Melba, sorry to jump so late into this topic. I want to check parent and all children are checked. If i uncheck a child then, i want the parents to be unchecked. This i cannot get working. Thanks for assistance. Cheers mike Edited May 13 by mike1950r
Moderators Melba23 Posted May 13 Author Moderators Posted May 13 mike1950r, And what has this code to do with my UDF? You do not use it at all! Are you asking if the UDF can help you do as you require? If so, then please provide me with a runnable script showing an example of the treeview you wish to manipulate, including data to fill it. But I must warn you that I do not believe that the UDF can do what you wish. You imply that unchecking a single child will uncheck the parent - normal practice is to keep the parent ticked unless all the children are unchecked. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
mike1950r Posted May 13 Posted May 13 (edited) Hi Melba, Thanks anyway. Cheers mike Edited May 13 by mike1950r
Felicitas Posted May 17 Posted May 17 Hello Melba23, really great UDF. Looks great and works fantastic. However, I would like to select the parent elements with the space key. But then the child elements are no longer automatically selected. Is there a solution for this? Unfortunately I don't know where to start. Thank you in advance.
Moderators Melba23 Posted May 17 Author Moderators Posted May 17 (edited) Felicitas, Glad you like it. Try this Beta version: GUITreeViewEx_Test.au3 Good to go? M23 Edited May 17 by Melba23 Modified code Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Felicitas Posted May 22 Posted May 22 Hello Melba, sorry for answering so late. Thank you very much, that works wonderfully. From your comment I was also able to see where you did something to the code. This helps me understand it a little better. Thanks
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