Jump to content
Sign in to follow this  
Clark

Weird treeview issue

Recommended Posts

Clark

Hi there

I am getting a strange issue occuring with treeview.

The below code creates a three level treeview.  Each top level item has subitems, so all the top level items should have a "+" before them, allowing them to be expanded.

However, what is happening is that the last top level item is not showing a plus sign, until it is clicked once - then the plus sign appears.

Does anyone have an idea as to why this is happening?

Func _Populate_System_Treeview()
   local $iNumberSystems,$iCount,$iFields,$tempRecord,$tv1,$tv2,$tv3
   $sSQL="Select * from tbl_systems;"
   If Not _EzMYSql_Query($sSQL) Then
      MsgBox(0, "Query Error", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
   EndIf   
   $iNumberSystems = _EzMySql_Rows()                            ; Number of systems (rows) in the table
   global $tvi[$iNumberSystems][5]                              
   for $iCount = 0 to $iNumberSystems-1                         ; for each row in the table
      $tempRecord = _EzMySql_FetchData()                        ; Read the row into a temporary var
      for $iFields = 0 to 3
         $tvi[$iCount][$iFields]=$tempRecord[$iFields]              ; Fourth field reserved for pointer to treeviewbox items
      Next
   Next
   _ArraySort($tvi,0,0,0,0)
   for $iCount = 0 to $iNumberSystems-1
      Switch $tvi[$iCount][2]                           ; SYS_level field
         Case 1                                                 ; Top level
            $tv1=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $treeview)                 ; Display the item
            $tvi[$iCount][4]=$tv1
         Case 2                                                 ; Second level
            $tv2=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $tv1)
            $tvi[$iCount][4]=$tv2           
         Case 3                                                 ; THird level
            $tv3=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $tv2)
            $tvi[$iCount][4]=$tv3
         Case Else                                              ; Should never happen
            ; msgbox(0,"Warning","Undefined system level detected")
      EndSwitch
   Next
EndFunc

Share this post


Link to post
Share on other sites
Melba23

Clark,

Unless you provide some runnable code which shows the problem, you are unlikely to get any useful responses. At present you are expecting us to write our own code to create a GUI to hold your treeview, create a SQL databasde to query with no idea what the resultant array format, and then add your function to even see the problem. Would you be prepared to do all that? :huh:

You post a runnable script which illustrates the problem and I will be happy to look into what might be happening. But at the moment there is absolutely no chance. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Clark

OK, fair call, although I was hoping that someone could just spot the problem in the code without necessarily having to run it.

Anway, I have added some code around it to illustrate the issue - although now you don't need to click the last line of the treeview to make the final + appear - you just have to hover over it. 

#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Array.au3>

$Form1_1 = GUICreate("Request for Change", 977, 917, 467, 37)

$TreeView = GUICtrlCreateTreeView(617, 190, 336, 300,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)

_Populate_System_Treeview()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
         Case $GUI_EVENT_CLOSE
            Exit
  EndSwitch
WEnd



Func _Populate_System_Treeview()
   ; Due to the retardness of the mySQL udf this has to be build as an in-memory array rather than straight to screen
   local $iNumberSystems=27,$iCount,$iFields,$tempRecord[5],$tv1,$tv2,$tv3
   global $tvi[$iNumberSystems][5]
   for $iCount = 0 to $iNumberSystems-1                         ; for each row in the table
      $tempRecord = _Emulate_EzMySql_FetchData($iCount)         ; Read the row into a temporary var
      for $iFields = 0 to 3
         $tvi[$iCount][$iFields]=$tempRecord[$iFields]          ; Fourth field reserved for pointer to treeviewbox items
      Next
   Next
   _ArraySort($tvi,0,0,0,0)
   for $iCount = 0 to $iNumberSystems-1
      Switch $tvi[$iCount][2]                                   ; SYS_level field
         Case 1                                                 ; Top level
            $tv1=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $treeview) ; Display the item
            $tvi[$iCount][4]=$tv1
         Case 2                                                 ; Second level
            $tv2=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $tv1)
            $tvi[$iCount][4]=$tv2           
         Case 3                                                 ; THird level
            $tv3=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $tv2)
            $tvi[$iCount][4]=$tv3
         Case Else                                                  ; Should never happen
            ; msgbox(0,"Warning","Undefined system level detected")
      EndSwitch
   Next
EndFunc

Func _Emulate_EzMySql_FetchData($idx)
   local $retstring[5],$lCntr
   local $tvi[28][3] = [ _
   [100,"SAP ERP",                  1], _
   [110,"(CRM) Customer Relationship Management",   1], _
   [111,"Interaction Centre",                   2], _
   [112,"Activity and CRM Ticket Mgmt",             3], _
   [113,"Grants CRM Mgmt",                      3], _
   [114,"Electronic Document Records Mgmt System",3], _ 
   [120,"(ECC) ERP Central Component",          3], _
   [121,"Finance Controlling and Funds Mgmt",       2], _ 
   [122,"Human Capital Mgmt",                       3], _ 
   [123,"Materials Mgmt",                           3], _  
   [124,"Treasury Mgmt System",                 3], _   
   [130,"Enterprise Portal",                    3], _
   [140,"Business Intelligence/Warehouse",  2], _
   [150,"XI / PI Interfaces",                   2], _
   [160,"Solution Manager",                 2], _   
   [200,"GOS",                      2], _
   [210,"Lotos",                            1], _
   [220,"BOS",                              2], _
   [230,"Terminal",                             2], _   
   [300,"Corporate IT",             2], _
   [310,"Email",                            1], _
   [320,"Intranet",                         2], _
   [400,"Digital Point of Presence",    2], _
   [410,"Play Online",                          1], _
   [420,"Retail Link",                          2], _ 
   [430,"Corporate Website General",            2], _
   [440,"Corporate Website Grants",             2]]
   for $lCntr = 0 to 2
         $retstring[$lCntr]=$tvi[$idx][$lCntr]
   Next
   return ($retstring)
endfunc

Share this post


Link to post
Share on other sites
BrewManNH

Good call NewPlaza, that seems to have fixed it on my system at least.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Clark

Thanks for that good try.

I tried that previously, but unfortunately it doesn't fix it on my system.  Not on the "real" program nor the "test" program I have included.

In fact, on the test program it makes it emulate the real program, in that the + does not appear until I click the last line.  Very strange.

Share this post


Link to post
Share on other sites
BrewManNH

I tried your example script and I was seeing the problem before moving the GUISetState function below the line that creates the treeview. After moving it, the problem went away, at least on the 2 different computers I ran it on.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
BrewManNH

One trick you could use is adding this line after your return from creating all of the treeview items.

GUICtrlDelete(GUICtrlCreateTreeViewItem("",$TreeView))

This adds an additional root level treeview item and immediately deletes it, which makes the bottom treeview item have the "+" sign show up every time.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
FireFox

It works here (Windows XP), so it may be a missing control redraw call (in Windows 7?)

This should fix the issue (although I can't test it to adapt the redraw message).

_WinAPI_RedrawWindow($Form1_1, 0, $hTreeeView, $RDW_ERASENOW)
Br, FireFox. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Clark

Brewman's method works a treat.  Thanks.

Firefox I didn't try your method but thanks for that.

And thanks to all for the good trys.

Share this post


Link to post
Share on other sites
kylomas

@all - Follow-up

I recently had exactly the same problem.  Adding a "_guictrltreeview_beginupdate",  "_guictrltreeview_endupdate" pair fixed it...

#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <GuiTreeView.au3> ; <---- added for _guictrltreeview* functions

$Form1_1 = GUICreate("Request for Change", 977, 917, 467, 37)

$TreeView = GUICtrlCreateTreeView(617, 190, 336, 300,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)

_Populate_System_Treeview()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
         Case $GUI_EVENT_CLOSE
            Exit
  EndSwitch
WEnd



Func _Populate_System_Treeview()
    ;
    _GUICtrlTreeView_BeginUpdate($treeview) ; <-----  added
    ;
   ; Due to the retardness of the mySQL udf this has to be build as an in-memory array rather than straight to screen
   local $iNumberSystems=27,$iCount,$iFields,$tempRecord[5],$tv1,$tv2,$tv3
   global $tvi[$iNumberSystems][5]
   for $iCount = 0 to $iNumberSystems-1                         ; for each row in the table
      $tempRecord = _Emulate_EzMySql_FetchData($iCount)         ; Read the row into a temporary var
      for $iFields = 0 to 3
         $tvi[$iCount][$iFields]=$tempRecord[$iFields]          ; Fourth field reserved for pointer to treeviewbox items
      Next
   Next
   _ArraySort($tvi,0,0,0,0)
   for $iCount = 0 to $iNumberSystems-1
      Switch $tvi[$iCount][2]                                   ; SYS_level field
         Case 1                                                 ; Top level
            $tv1=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $treeview) ; Display the item
            $tvi[$iCount][4]=$tv1
         Case 2                                                 ; Second level
            $tv2=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $tv1)
            $tvi[$iCount][4]=$tv2
         Case 3                                                 ; THird level
            $tv3=GUICtrlCreateTreeViewItem($tvi[$iCount][1], $tv2)
            $tvi[$iCount][4]=$tv3
         Case Else                                                  ; Should never happen
            ; msgbox(0,"Warning","Undefined system level detected")
      EndSwitch
  Next
    ;
    _GUICtrlTreeView_endUpdate($treeview) ; <--- added
    ;

EndFunc

Func _Emulate_EzMySql_FetchData($idx)
   local $retstring[5],$lCntr
   local $tvi[28][3] = [ _
   [100,"SAP ERP",                  1], _
   [110,"(CRM) Customer Relationship Management",   1], _
   [111,"Interaction Centre",                   2], _
   [112,"Activity and CRM Ticket Mgmt",             3], _
   [113,"Grants CRM Mgmt",                      3], _
   [114,"Electronic Document Records Mgmt System",3], _
   [120,"(ECC) ERP Central Component",          3], _
   [121,"Finance Controlling and Funds Mgmt",       2], _
   [122,"Human Capital Mgmt",                       3], _
   [123,"Materials Mgmt",                           3], _
   [124,"Treasury Mgmt System",                 3], _
   [130,"Enterprise Portal",                    3], _
   [140,"Business Intelligence/Warehouse",  2], _
   [150,"XI / PI Interfaces",                   2], _
   [160,"Solution Manager",                 2], _
   [200,"GOS",                      2], _
   [210,"Lotos",                            1], _
   [220,"BOS",                              2], _
   [230,"Terminal",                             2], _
   [300,"Corporate IT",             2], _
   [310,"Email",                            1], _
   [320,"Intranet",                         2], _
   [400,"Digital Point of Presence",    2], _
   [410,"Play Online",                          1], _
   [420,"Retail Link",                          2], _
   [430,"Corporate Website General",            2], _
   [440,"Corporate Website Grants",             2]]
   for $lCntr = 0 to 2
         $retstring[$lCntr]=$tvi[$idx][$lCntr]
   Next
   return ($retstring)
endfunc

kylomas

edit: @Clark - Your array to populate the treeview requires strict order of items in the array.  See thread

for another way to do this using an array.

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
FireFox

Maybe because the EndUpdate function redraws the treeview.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


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
Sign in to follow this  

  • Similar Content

    • Sven-Seyfert
      By Sven-Seyfert
       
      Hi Community,

      I have a problem with the usage of _GUICtrlTreeView_AddChild and setting different item text colors (and different background colors), separately for the TreeView levels.

      I use the UDF GUITreeViewEx.au3 of 'Melba23' and I renamed the functions to increase my understanding about the content. I already talked to him about his UDF to respect his rights and intellectual property. I read many forum threads, I tried many ways to get it, but it's seems to be impossible in the way that I use the UDF.

      Question:
      How can I set different item text colors, separately for the TreeView levels?
      How can I set different item background colors, separately for the TreeView levels?

      I found out that _GUICtrlTreeView_AddChild don't let my set this properties directly. But after loading the TreeView content I can't change the items (children) too. Only the font weight to bold I could set with _GUICtrlTreeView_SetBold but I want to do this in a generic way directly at the creation (loading) of the TreeView.

      Of course I tried the different functions to set text color or bkgColor, but it didn't work - maybe I do it wrong.
      I really hope you can help me, give me a hint and understand what I want to do.
      [Solved] final solution made by @LarsJ (see below)

      Thanks for your help - I'm grateful!
      Sven

      CODE
      BEFORE
      AFTER
      ExecutionPlan.zip
    • gillesg
      By gillesg
      Hello,
      I am struggling in merging GUITreeViewEx, Shelltristate and enhancing to handle a third state that means : some items under are selected.
      I have difficulties handling expand order and key Space (especially when node is collapsed).
      Here the zip with UDF and and example.
       
      The problem I might need some advice to handle : 
      1- When load Treeview, have a correct settings of the checkbox for a tristate tree
      2 - Handle keyboard used for walking in tree
           Chicken is checked and  Steak is unchecked
          When walking with arrow to Meat, it gets unchecked
      3 - When node is collapsed and checked thru keyboard (space)
         the middle state is possible which should not
      Here is joined an animated gif showing the 3 problems
       
      Thanks for your advices
       
       
       
       
       
       
       
       
       
       
       

      GUITreeview3Ex.zip
    • gillesg
      By gillesg
      Hello,
      I just bumped into this problem with _GUICtrlTreeView_Sort.
      Just used doc example and comment out the child creation
      #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Example() Func Example() Local $aidItem[10], $iX = 9, $iY = 29, $idTreeView Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) GUICreate("TreeView Sort", 400, 300) $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) _GUICtrlTreeView_BeginUpdate($idTreeView) For $x = 0 To 3 $aidItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $iX), $idTreeView) $iX -= 1 For $y = 1 To 3 ; GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iY), $aidItem[$x]) $iY -= 1 Next Next _GUICtrlTreeView_Expand($idTreeView) _GUICtrlTreeView_EndUpdate($idTreeView) MsgBox($MB_SYSTEMMODAL, "Information", "Sort") _GUICtrlTreeView_Sort($idTreeView) _GUICtrlTreeView_SelectItem($idTreeView, $aidItem[9]) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example The tree is not sorted.
       
      There is a similar problem with deeper tree
      Also based on the example
      #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Example() Func Example() Local $aidItem[10], $bidItem[10], $iX = 9, $iY = 29, $idTreeView Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) GUICreate("TreeView Sort", 400, 300) $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) _GUICtrlTreeView_BeginUpdate($idTreeView) $index=0 For $x = 0 To 3 $aidItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $iX), $idTreeView) $iX -= 1 For $y = 1 To 2 $BidItem[$y]= GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iY), $aidItem[$x]) $iY -= 1 For $z= 1 To 2 GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iY), $BidItem[$y]) $iY -= 1 Next Next Next _GUICtrlTreeView_Expand($idTreeView) _GUICtrlTreeView_EndUpdate($idTreeView) MsgBox($MB_SYSTEMMODAL, "Information", "Sort") _GUICtrlTreeView_Sort($idTreeView) _GUICtrlTreeView_SelectItem($idTreeView, $aidItem[9]) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example The tree is now 2 level deep and it is not properly sorted.
       
      Any advices ?
       
      Regards
    • corgano
      By corgano
      I can't explain easily what i want to do, so i made a picture:

      What i want to do is to specify a treeview item, and then be able to move it right to be a child of the previous item, or left to do the opposite (make a child into a sibling). I also want to move and child items of the target with it, like in the bottom half of the above image depicts. However I didn't see any functions in the help file to move items around. All i want is a button that when pressed, makes the selected item and any of selected item's children move one layer to the right / left. Does anyone know how?

      Edit: something along the lines of _GUICtrlTreeView_Level but SET level
    • Tjalve
      By Tjalve
      Hi everyone. Im creating a GUI for an application. Im usinga  treeview item and i want to add some information to the side of the treeview based on what cilditem you are pressing. For the moment i have a "get info" button that works. But that means that you have to select your child in the treeview, and then press a button to gte the info. I want the info to be visable as soon as you select it.
      With uther controls you can just add it to the loop but it doesnt seem to work with tyhe UDF version of the treeview control. Is there anything I can do?
      #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> ;~ Create GUI dim $guilabel[7] local $currentlevel = 1 Local $hGui = GUICreate( "Grejs", 1000, 500, 600, 300, BitOR( $GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX ) ) Local $iBorderWidth = 4, $aPos = WinGetClientSize( $hGui ) $idTV = _GUICtrlTreeView_Create($hGui, $iBorderWidth, $iBorderWidth, $aPos[0]-2*$iBorderWidth-400, $aPos[1]-2*$iBorderWidth-30 ) $root_level = _GUICtrlTreeView_Add($idTV,0,"Root") $item1 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child1") $item2 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child2") $item3 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child3") ;~ Start Gui GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idTV MsgBox(0,"","") EndSwitch WEnd GUIDelete($hGui) Exit In this example, i want the msgbox to appear whenevr i select something in the treeview. It ios not my full code, but its an example of the problam i have. Help is much appritiated
      /G
×