Jump to content
Sign in to follow this  

_GUICtrlTreeView_EditText/_EndEdit Isuse?

Recommended Posts

Hi to Great AUTOIT Community.

I have Problem with _GUICtrlTreeView_EndEdit and _GUICtrlTreeView_EndEdit .

Problem in that it is unable to save changes (in this case user input) to edited items text.

From help file:_GUICtrlTreeView_EditText() (<= Begins in-place editing of the specified item's text)

and for _GUICtrlTreeView_EndEdit() (<= Ends the editing of the item's text)

But in fact both examples didn`t works for me anymore:(I mean it is unable to save my changes to Treeview item and after sleep(2000) text which i have entered in it simply resets to default:( )

For ex:(From Help File )

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work


Func _Main()

    Local $hItem[6], $hImage, $tRect, $hTreeView
    GUICreate("TreeView Edit Text", 400, 300)

    $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    ; turn off unicode at this time dllstruct doesn't support them
    _GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)

    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 165)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 168)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 146)
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

    For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
        $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
    ; Edit item 0 label
    _GUICtrlTreeView_EditText($hTreeView, $hItem[0])
    Send("This is a test")

    ; Loop until user exits
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

I searched forum and found another WM_* methods.Again i cannot figure it out to work properly.

Can anybody say me may be i misunderstand somethink or this is not fixed bug? (If i am not correct please forgive me for that because 2 hours i want to figure it out to work but all my actions unsuccessfull for me and i`m in stuck)

Thanks in advance.

[size="5"] [/size]

Share this post

Link to post
Share on other sites

That example script has... issues. ;)

When you run _GUICtrlTreeView_EditText() it returns the handle to the Edit control that is created. It's on you to handle events in the Edit control, like when the text changes or it loses focus, and then read the text from the Edit control, end the edit with _GUICtrlTreeView_EndEdit(), and change the text of the item.

None of that is automatic, nor is it included in that example.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...