[SOLVED]Stop calling OnClicked event when DragnDropFromControl in treecontrol ?

Started by stephan_35, August 25, 2009, 03:18:17 PM

Previous topic - Next topic

stephan_35

Hello,

I discover that event "OnClicked" is called again before DragnDropFromControl, and that maybe because DragnDropFromControl event delete the node or because of changing node (depending if move or copy).

"Onclicked" is selected first !

My question is, could it be easy for you to stop calling "Onclicked" event ???

Yes, because, i didn't clicked anything else after droping action in TreeControl !

Best Regards & thanks.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

I don't understand the problem. I did a quick test, and indeed OnClicked is called when you select a tree item with the mouse to begin a drag and drop operation. This is working as it should, I think.
Owen Wengerd (Outside The Box) / ManuSoft

stephan_35

Quote from: owenwengerd on August 25, 2009, 09:12:10 PM
I don't understand the problem. I did a quick test, and indeed OnClicked is called when you select a tree item with the mouse to begin a drag and drop operation. This is working as it should, I think.


http://www.ad-informatique.net/pages//posts/opendcl---event-onclicked-called-with-dragndropfromcontrol-event33.php

OnClicked is call, but not the good one !

Best regards
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

stephan_35

#3
Hello,

Some news, now i can't know wich item was selected on dragndrop event !!!

After select one, oneclicked event return the good one,
If you select another item and if you directky move it to  another item , there is no way to know wich one was selected !

As i explain onClicked return the next selected item after move action,(and no the selected item)

That is a problem for me ! thanks for help

The solution should be return in DragnDropFromControl event  the SelectedItem "From"  (like droppoint), or return in OnClicked event the selected item "From" ....

Best regards .
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

It sounds like you have trouble because asynchronous events do not fire until AutoCAD is quiescent.  Do you have better luck if you change the tree control's Event Invoke property to 'Synchronous'?
Owen Wengerd (Outside The Box) / ManuSoft

stephan_35

Quote from: owenwengerd on August 27, 2009, 10:21:19 AM
It sounds like you have trouble because asynchronous events do not fire until AutoCAD is quiescent.  Do you have better luck if you change the tree control's Event Invoke property to 'Synchronous'?

Thanks for reply owen  ;)

So, i 'll try what you suggest me , and i'll cross my finger  :D

i just see that i can use tree control from windows,should i have better luck with this ???

Best regards.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

stephan_35

Less than before !

now, onclicked return the last selectd node !!!

and DragnDropFromControl return the good drop point but nothing change with onclicked wihtin dragondrop !!!

that is a problem  >:(

I don't know how to get the selected item within dragndropfromcontrol event !

i'll get all suggest for    ;)

thanks
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

Quote from: stephan_35 on August 27, 2009, 12:34:48 PM
I don't know how to get the selected item within dragndropfromcontrol event !

Do you mean the destination item, or the source item? The source should be the one that was selected in OnClicked; the destination item should be passed as the last argument to OnDragnDropFromControl.
Owen Wengerd (Outside The Box) / ManuSoft

stephan_35

Quote from: owenwengerd on August 27, 2009, 01:29:41 PM
Do you mean the destination item, or the source item? The source should be the one that was selected in OnClicked; the destination item should be passed as the last argument to OnDragnDropFromControl.

I mean source item (or From item), and i know that the source should be return by Onclicked event !

That is what i try to explain to you from the begining :it's impossible to know wich item was selected because onClicked does not return the correct selected item, it return only next selected item after move action !!!!!!!

I know that i must improve my english  ;D

Thanks for help
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

stephan_35

Hello owen,


you can have a see here :

http://www.ad-informatique.net/pages//posts/opendcl---event-onclicked-called-with-dragndropfromcontrol-event33.php

When i move node24 to  node3 Onclicked event return node25 ???

When i drop directly node29 to node4, never seen Onclicked event "Node29" !!!!!


Thanks

Best regards
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

I watched your video, and it helps me understand what you are saying.

Quote from: stephan_35 on August 27, 2009, 03:07:06 PM
When i move node24 to  node3 Onclicked event return node25 ???

  This looks correct to me. Node 25 is "selected" after the drag/drop operation is completed because Node 24 no longer exists.


Quote from: stephan_35 on August 27, 2009, 03:07:06 PM
When i drop directly node29 to node4, never seen Onclicked event "Node29" !!!!!

I will see if I can reproduce this.
Owen Wengerd (Outside The Box) / ManuSoft

owenwengerd

I tested, and I could not see any bug in the code. In my test, the OnClicked event always fires when it should. The problem you have is that in the case of a drag and drop operation, OnClicked does not fire until after the drag and drop operation completes. This is working as designed.

To accomplish what you want, you'll need to either handle the OnSelChanged event, or better, call GetSelectedItem from the OnDragnDropBegin event. During OnDragnDropBegin the source item will be the current selection.
Owen Wengerd (Outside The Box) / ManuSoft

stephan_35

Hello owen,

here is what i try, as you suggest me :

Event "SelChanged" :

During DragnDrop action ,nothing has changed !
Return only the last know position as getselecteditem, but no the selected item witch has been moved !
in fact the same as "OnClicked" event !

GetSelectedItem during OnDragnDropFromControl :
Get the last selected item

GetSelecteditem during OnDragnDropBegin :

YES!!! This work fine BUT: CTRL KEY & SHIFT KEY has no effect during Drag & Drop ation, so no choice of copy or move !!!!  >:( as i explain in another post ....

so, what could i do now !

I really hope to find an issue  ;D

Thanks.

Best regards.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

stephan_35

hello owen.

I'm afraid about modify DragnDropFromControl event and catch the seletitem before it was moved or copy ???
or any event to catch the selected item before it has been moved ...

I know how much time you may spend on it .....

I'm afraid about go round in circles .... ;D

Thanks

Best regards.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

I've made a change in the next build to allow both move and copy even when OnDragnDropBegin is enabled. Please test it and let me know whether the change causes any problems.
Owen Wengerd (Outside The Box) / ManuSoft