TreeDragDrop question

Started by Fred Tomke, October 29, 2007, 01:42:25 AM

Previous topic - Next topic

Fred Tomke

Hello,

I've attached a small project and a lisp. (using Beta 2)

Please load it. A dockabled form with two parent items will be shown.
Drag is allowed in the tree.
Drop is allowed in the tree.
Click one item after the other. After clicking one item SelChange event will be released after moving the mouse one pixel. After disabling the AllowDrag property, selchanged event will be fired immediately.
I found out that OnClick event will be fired immediately after clicking in the tree only when AllowDrag property is disabled but it will only be released (when AllowDrag property is enabled) after clicking an already selected item a second time. Thats why I added the event OnSelChanged.

Maybe it depends on the eventinvoke.

If a video could explain it better, so let me know.

I place my note here in case of the fact these things could be by design. On the other hand I didn't find an option to upload files in this forum http://sourceforge.net/forum/forum.php?forum_id=658811 .

Regards,
Fred

[attachment deleted by admin]
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Fred, I believe this is working as designed. When drag 'n drop is enabled, mousedown initiates a drag operation. However, it is normal Windows behavior that if the mouse is released again before moving outside the double-click rectangle, the drag operation is cancelled.

The problem with the OnSelChanged event not firing until you move the mouse is due to the EventInvoke setting; change it to 0 for the tree control and that event fires as soon as the mouse button is pressed down. The OnClick event does seem to behave a bit strangely when DragDropAllowBegin is true, but I don't see anything unusual in the code, so I think it is working in the way that Microsoft designed the tree control.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Hello Owen,

thank you for your reply.
Unfortunately, I need the AllowCommand value in EventInvoke because some things won't work with keep focus. If I use the value 0 I cannot start several commands in AutoCAD (picking points etc.).

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Quote from: Fred Tomke on November 02, 2007, 02:19:58 AM
Unfortunately, I need the AllowCommand value in EventInvoke because some things won't work with keep focus. If I use the value 0 I cannot start several commands in AutoCAD (picking points etc.).

I don't think there is any way to do those things while a drag operation is in progress. You could use SendString to send commands from the handler, but the effect would be no different than if you had set EventInvoke to 1.  In either case, AutoCAD will wait to process the command input until the drag operation is completed.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Sorry, Owen, I'm afraid there is a misunderstanding. I don't want to do anything in AutoCAD while drag&drop process. But I have to enable it for sorting elements in the tree. On the other hand allowcommand must be set to start autocad commands by doubleclicking a tree item. The problem I explained does only occur if both is enabled: AllowDrag for individual sorting and EventInvoke=AllowCommand for starting AutoCAD-commands after double click.

In other forms I solved this problem with a toggle in the dialog for enabling drag&drop. I explained this toggle to the customers that some don't want to start drag&drop unexpectively. Who don't want to use drag&drop they should disable drag&drop. But this explanation only covers this problem: OnClick event will be fired immediately after clicking in the tree only when AllowDrag property is disabled but it will only be released (when AllowDrag property is enabled) after clicking an already selected item a second time.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Quote from: Fred Tomke on November 02, 2007, 02:30:26 PM
On the other hand allowcommand must be set to start autocad commands by doubleclicking a tree item.

In that case, I think you can leave EventInvoke set to 0, but in the double click event handler, use (dcl_SendString) to send the command.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Thanks Owen, I'll try that next week.
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]