Jump to content

GUITreeViewEx - New Release 11 Jan 15


Recommended Posts

@maniootek: Melba is not around this week, so you may have to wait a while for a reply. Just so you know.;)

Link to post
Share on other sites
  • Moderators

maniootek,

You can very easily write a small function to convert an array to a suitably formatted string which the UDF will accept:

#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 

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

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:

57074673492ad_GuiTreeViewExerror.PNG.d50

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

maniootek,

Yes, that is the solution.

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
  • Moderators

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

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
  • 1 year later...
  • 11 months later...
  • Moderators

joiner,

Delighted you find the UDF useful.

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
  • Moderators

MattHiggs,

Your posts concerning ListViews have been split off and can been found here.

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

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...