Sign in to follow this  
Followers 0
tobias7

_GUICtrlTreeView_Delete BUG

3 posts in this topic

First off, I'm sorry I didn't post under bugs, but I couldn't figure out how. I kept getting the permission denied screen. Okay, this is a really weird one. First I used a right click context menu. Then I was working with a GUITreeView and when I deleted something on the tree, a function from the right click context menu was called. After playing around a lot, I narrowed it down to about 50 lines of code, which I have included. I found that if I deleted a specific item on the tree, and it was selected, then the right click function was called. If I deleted that same item on the tree and it was not selected, the right click function was not called. This only happens with certain items on the tree, though.

In my code, if the right click menu function is called, the program exits. I also have two lines where if the first is commented out, the program works fine, but if the second is commented out instead, the program calls the right click function.

I am using AutoIt non-beta version 3.2.10 and I have Windows XP

Thanks very much

#Include <GuiTreeView.au3>

Opt("GUIOnEventMode", 1)

$mainWindow = GUICreate("Test", 200, 200)

$rightClickMenu = GUICtrlCreateContextMenu()
$rNextPage = GUICtrlCreateMenuItem("Next Page", $rightClickMenu)
$rPrevPage = GUICtrlCreateMenuItem("Previous Page", $rightClickMenu)
$rLoadPage = GUICtrlCreateMenuItem("Load Report", $rightClickMenu)
$rSavePage = GUICtrlCreateMenuItem("Save Report", $rightClickMenu)
GUICtrlSetOnEvent($rSavePage, "SaveReport")

$quickTreeButtonD = GUICtrlCreateButton("Delete", 50, 10)

$quickTree = _GUICtrlTreeView_Create($mainWindow, 0, 40, 200, 200)
$s1 = _GUICtrlTreeView_AddChild($quickTree, 0, "1")
$s2 = _GUICtrlTreeView_AddChild($quickTree, 0, "2")
$s3 = _GUICtrlTreeView_AddChild($quickTree, 0, "3")
$s4 = _GUICtrlTreeView_AddChild($quickTree, $s3, "4")
$s5 = _GUICtrlTreeView_AddChild($quickTree, $s3, "5")
$s6 = _GUICtrlTreeView_AddChild($quickTree, $s5, "6")
$s7 = _GUICtrlTreeView_AddChild($quickTree, $s3, "7")
$s8 = _GUICtrlTreeView_AddChild($quickTree, 0, "8")

GUICtrlSetOnEvent($quickTreeButtonD, "TreeMoveSelectedDown")

GUISetState(@SW_SHOW)

While 1
  Sleep(100)
WEnd

Func TreeMoveSelectedDown()
  _GUICtrlTreeView_SelectItem($quickTree, $s5) ;comment this and
  ;_GUICtrlTreeView_SelectItem($quickTree, $s4) ;uncomment this to make the code work fine
  _GUICtrlTreeView_Delete($quickTree, $s5)
EndFunc

Func SaveReport()
  Exit ;SaveReport() is called for no apparent reason!!!
EndFunc

Share this post


Link to post
Share on other sites



Thank you. I guess I'll just have to try the beta version.

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  
Followers 0