I want to drag an item from a treeview to a canvas
BlitzMax Forums/BlitzMax Programming/I want to drag an item from a treeview to a canvas
| ||
I want to drag an item from a treeview to a canvas. Is this possible with the windows API? I don't care if it is tricky, but it is possible? |
| ||
Should be simple: - handle the single click on the tree and the item. Think the select event is fired in that case. (and action on double click) - Change cursor icon and remove the item from tree but store its parent if you need to put it in again as it was not dropped on canvas - handle the mousebutton up over the canvas -> drop there and |
| ||
I don't actually need to remove the item, but I want some kind of transparent icon to appear next to the mouse cursor, so it is apparent to the user you are dragging something into the canvas. I would be very surprised if the canvas fired a mouse up event from a button press that originated elsewhere. |
| ||
icon: Change the mouse cursor to show an icon mouse up: if you check if the mouse is over the canvas (in the mouse move) and manually set it to active, then yes it will fire one :) |
| ||
Just because a treeviewnode was selected doesn't mean you are holding down the mouse. Does Windows support something like this? I am not interested in home-made solutions that don't work. |
| ||
http://msdn2.microsoft.com/en-us/library/bb773409(VS.85).aspx MR offensive. |
| ||
Windows does support a lot but unless you wrote LeadwerksGUI to do it for you, you won't have it. Using Windows API and operating on MaxGUI stuff is critical because it can potentially just change and your stuff will be broken. |
| ||
Oh sweet, I didn't realize it was right there. Thanks. This will be tricky, but it's worthwhile. |
| ||
Well I can detect tree view drag events: case TVN_BEGINDRAG: MessageBox(0,"Tree View Drag Event","Tree View Drag Event",MB_OK); Only problem so far is when I drag a treeview item, BlitzMax automatically selects the last selected node, not the one I am dragging. How can I change this? Right now I am trying to make Windows select the treeviewnode when a drag operation starts: From win32treeview.cpp: case TVN_BEGINDRAG: //MessageBox(0,"Tree View Drag Event","Tree View Drag Event",MB_OK); _selected=(Win32TreeViewNode*)nm->itemNew.lParam; SendMessage(_gadget.hwnd(),TVM_SELECTITEM,TVGN_CARET,(int)_selected); emit( 690,(int)_selected ); break; Judging from the results of the other tree events, it doesn't look like treeview events in maxgui actually return the treeview node gadget they should. |