Hi
I’ve found an intermittent problem with my app. During drag and drop I find that MouseUp usually fires before DropObject, but occasionally, like one in 10 events, they fire around the other way. Of course that tends to mess things up a bit when one is dependent upon the results of the other.
The only comment I have is that over the 14 years I have been using RB/RS/Xojo, I have repeatedly been advised not to depend on the order of event firings.
[quote=151507:@James Pitchford]Hi
I’ve found an intermittent problem with my app. During drag and drop I find that MouseUp usually fires before DropObject, but occasionally, like one in 10 events, they fire around the other way. Of course that tends to mess things up a bit when one is dependent upon the results of the other.
Does anyone have any experience of this?
[/quote]
Since the dropObject cannot take place without MouseUp having taken place, why not put all your code in there ?
This was precisely the problem - sometimes the dropObject would fire before the MouseUp - cannot explain why.
In the end I added a Timer to go off 10msec after the dropObject to ensure both events had taken place before doing the work. Seems to work fine at the moment.
There’s no requirement for a timer in this situation. Add a boolean property to the window named “bothDragEventsHappened”. In both the MouseUp and DropObject handlers, use this code:
if bothDragEventsHappened then
ProcessTheDragEvent //a window method that processes the drag
bothDragEventsHappened=false
else
bothDragEventsHappened=true
end