Jump to content

Recommended Posts

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 by Solchael
Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
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 : 

#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) :

 image.png.c56bb196b992c42ecf123fa9f70cbbe8.png                    image.png.a8a181c98d742949f32ffe18d0d056cc.png

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 by Solchael
Link to post
Share on other sites

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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...