Solchael Posted October 19, 2022 Share Posted October 19, 2022 (edited) Hello, I am not new here, but usually using others issue / topic to solve mine ! I am trying to use some TreeView. I was wondering is it possible to mix the Native command with UDF one ? Or it's not suggested ? Regards, Solchael Edited October 19, 2022 by Solchael Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 19, 2022 Moderators Share Posted October 19, 2022 Solchael, As a rule of thumb it is better to keep the 2 separate - but you can certainly use some of the UDF functions on a native ListView, whereas the converse is only rarely true. Do you have any specific cases in mind? 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 Link to comment Share on other sites More sharing options...
Solchael Posted October 19, 2022 Author Share Posted October 19, 2022 (edited) 13 minutes ago, Melba23 said: Solchael, As a rule of thumb it is better to keep the 2 separate - but you can certainly use some of the UDF functions on a native ListView, whereas the converse is only rarely true. Do you have any specific cases in mind? M23 Well I did wrote that : expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Global $ahItem1, $ahItem2, $ahItem3, $aidChildItem1, $aidChildItem2, $aidChildItem3, $aidChildItem4, $aidChildItem5, $aidChildItem6, $aidChildItem7, $aidChildItem8, $aidChildItem9, $idTreeView Global $bhItem1 Example() Func Example() Local $iStyle = BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES) GUICreate("TreeView Set State Image Index", 400, 300) GUISetState(@SW_SHOW) $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) #Region $ahItem1 $ahItem1 = GUICtrlCreateTreeViewItem("Papa0", $idTreeView) _GUICtrlTreeView_SetStateImageIndex($idTreeView, $ahItem1, 0) $aidChildItem1 = GUICtrlCreateTreeViewItem( "Enfant01",$ahItem1 ) $aidChildItem2 = GUICtrlCreateTreeViewItem( "Enfant02",$ahItem1 ) $aidChildItem3 = GUICtrlCreateTreeViewItem( "Enfant03",$ahItem1 ) #EndRegion $ahItem1 #Region $ahItem2 $ahItem2 = GUICtrlCreateTreeViewItem("Papa1", $idTreeView) _GUICtrlTreeView_SetStateImageIndex($idTreeView, $ahItem2, 0) $aidChildItem4 = GUICtrlCreateTreeViewItem( "Enfant11",$ahItem2 ) $aidChildItem5 = GUICtrlCreateTreeViewItem( "Enfant12",$ahItem2 ) $aidChildItem6 = GUICtrlCreateTreeViewItem( "Enfant13",$ahItem2 ) #EndRegion $ahItem2 #Region $ahItem3 $ahItem3 = GUICtrlCreateTreeViewItem("Papa2", $idTreeView) _GUICtrlTreeView_SetStateImageIndex($idTreeView, $ahItem3, 0) $aidChildItem7 = GUICtrlCreateTreeViewItem( "Enfant21",$ahItem3 ) $aidChildItem8 = GUICtrlCreateTreeViewItem( "Enfant22",$ahItem3 ) $aidChildItem9 = GUICtrlCreateTreeViewItem( "Enfant23",$ahItem3 ) #EndRegion $ahItem3 If _GUICtrlTreeView_GetChecked($idTreeView, $ahItem1) Then MsgBox($MB_SYSTEMMODAL, "Information", "Checked") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Working quite fine (except the [+] button on the last Parents missing, but if I do hover my mousse on it, it does appear not sure what is the issue though) : Don't look at this line (it doesn't work) : If _GUICtrlTreeView_GetChecked($ahItem1, $aidChildItem1) Then MsgBox($MB_SYSTEMMODAL, "Information", "Checked") I am just trying to understand how to catch the event when someone click on this specific checkbox). Seems I can hide the parents checkbox mixing both. Regards, Solchael Edited October 19, 2022 by Solchael Link to comment Share on other sites More sharing options...
Solchael Posted October 19, 2022 Author Share Posted October 19, 2022 Just adding two line did fix this issue : 15 minutes ago, Solchael said: Working quite fine (except the [+] button on the last Parents missing, but if I do hover my mousse on it, it does appear not sure what is the issue though) : _GUICtrlTreeView_BeginUpdate($idTreeView) _GUICtrlTreeView_EndUpdate($idTreeView) Regards, Solchael 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