Jump to content

Treeview Drag and Drop... Move the item


ericg32
 Share

Recommended Posts

I've come to a roadblock and need a little help. I am trying to write a notecard program. Card titles on the left (Treeview) Content on the right (editbox). I need to be able to move the title up and down the tree rather than simple sort them. I can get the 'drag and drop' icons but cannot figure out how to determine the desitination.. Once I know that I can easily move the array content and redisplay the tree.

My confusion is due to the fact that there are newer tree functions now (UDF) that weren't available when the examples were written.

To run the progam and get results... use the latest beta.. Select "Import" and it will load a fixed tree rather than import a file.

Any help greatly appreciated !!!

testfolder.au3

Link to comment
Share on other sites

Siao I'm looking at the code..but it won't run.. getting error:

Running AU3Check (1.54.9.0) from:C:\Program Files\AutoIt3\beta

C:\Program Files\AutoIt3\beta\Include\GuiTreeView.au3(468,68) : WARNING: $DEFAULT_GUI_FONT: possibly used before declaration.

_WinAPI_SetFont ($hTree, _WinAPI_GetStockObject ($DEFAULT_GUI_FONT)

C:\Program Files\AutoIt3\beta\Examples\tt.au3(226,99) : WARNING: $SRCCOPY: possibly used before declaration.

_WinAPI_BitBlt($hMemDC, 0, 0, $iImgW, $iImgH, $hTreeDC, $aItemRect[0], $aItemRect[1], $SRCCOPY)

Any clues ?

Edited by ericg32
Link to comment
Share on other sites

Siao:

I was close !! But no cigar yet.

I'm having an issue after an item is moved in the tree. The original tree load gives direct ctrl-ids to each item in the tree view. When I hi-lite one, I can trap the ctrl number and place text in the edit box on the right.

When the tree is recalculated it's done in "index" mode, I think. So, all the contol-id's are no longer used (I get dup ctrl ids when the moved item is hilited).

I could use a little insight into how the treemove is being done. Yes Ive read the code and assoc doc but it's above my level (so far).

Any pointers .. what I want to be able to do is .. capturer the treeview list (I initially capture it in an array) and the associated text (in the second col of the array) so they need to be re-associated or kept in sync after the treemove.

I can load the current source if you need to see what I am doing in detail

Link to comment
Share on other sites

1) Work with item handles instead of controlIDs. None of the GuiCtrl... funcs will work obviously, since the items are not recreated with GUICtrlCreateTreeViewItem(). Use _GUICtrlTreeView_GetText() to get the text.

2) To trap selection change, add $TVN_SELCHANGED and $TVN_SELCHANGEDW case to WM_NOTIFY function. See the example, which I updated somewhat. Also might wanna see this list of treeview notifications if you need to trap some other events.

Edited by Siao

"be smart, drink your wine"

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