Jump to content

how to update/refresh a treeviewitem


HansH
 Share

Recommended Posts

I am trying to update a treeviewitem, is it possible ?

Something like :

#include <GUIConstants.au3>

$gui = GuiCreate("treeviewtest", 450, 488, 490,360)

$tree = GUICtrlCreateTreeView(10, 60, 300, 360,-1 , $WS_EX_CLIENTEDGE)
$item = GUICtrlCreateTreeViewItem("original text", $tree)

$bt_test = GUICtrlCreateButton("test", 330,60,60,20)
GUISetState ()

while 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then  ExitLoop
    if $msg = $bt_test Then
        GUICtrlSetData("new text", $item)
        GUICtrlSetState($item,$GUI_SHOW)
    EndIf
WEnd
Exit

But the treeitem keeps his old text, any ideas ?

Link to comment
Share on other sites

I am trying to update a treeviewitem, is it possible ?

<{POST_SNAPBACK}>

First you had the "GUICtrlSetData" wrong. (See code below and help file).

Second, I could only get it working with the beta. (I'm using the latest)

Will this help you on your way?

#include <GUIConstants.au3>

$gui = GuiCreate("treeviewtest", 450, 488, 490,360)

$tree = GUICtrlCreateTreeView(10, 60, 300, 360,-1 , $WS_EX_CLIENTEDGE)
$item = GUICtrlCreateTreeViewItem("original text", $tree)

$bt_test = GUICtrlCreateButton("test", 330,60,60,20)
GUISetState ()

while 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then  ExitLoop
    if $msg = $bt_test Then
        GUICtrlSetData($item, "new text")
        GUICtrlSetState($item,$GUI_SHOW)
    EndIf
WEnd
Exit
Link to comment
Share on other sites

First you had the "GUICtrlSetData" wrong. (See code below and help file).

Second, I could only get it working with the beta. (I'm using the latest)

Will this help you on your way?

#include <GUIConstants.au3>

$gui = GuiCreate("treeviewtest", 450, 488, 490,360)

$tree = GUICtrlCreateTreeView(10, 60, 300, 360,-1 , $WS_EX_CLIENTEDGE)
$item = GUICtrlCreateTreeViewItem("original text", $tree)

$bt_test = GUICtrlCreateButton("test", 330,60,60,20)
GUISetState ()

while 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then  ExitLoop
    if $msg = $bt_test Then
        GUICtrlSetData($item, "new text")
        GUICtrlSetState($item,$GUI_SHOW)
    EndIf
WEnd
Exit

<{POST_SNAPBACK}>

That's stupid of me, thx i am using the latest beta so that's ok

Hans

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...