I use Drap-and-drop in several areas, and it works great, allowing me to drag large numbers of files for processing. I 'ingest' the files and add them to a list, then rebuild the list-view. No problems
I ran across this as I added a functionality. In this new application, I want to take a dropped file, add it to an internal list, then rebuild the display using the rebuilt list. I do this because it will be rare for the user to be using this feature, so be building the display window with the updated list is not a big deal.
But I can't do it. When I attempt to return a negative value for the callback, it is 'ignored' (more later). The code below illustrates this. Two variables, one counting the number of 'drops', the other counting the rebuilds. On every third drop, it attempts to return a -1. It does not rebuild the window, and more oddly, the window is not updated. Click the 'X' to close the window, and it gets rebuilt using the proper return value!
So, attempting to return from a drag-and-drop callback with the return value to also closes the parent window fails. But a manual closing of that window returns the previous attempts callback value, and the window is rebuilt.
This occurs both in 32 and 64 bit
winapp
program main
use mswin
integer,external:: dropped_here
integer:: i,count_rebuild,count_dropped
common/dr/count_rebuild,count_dropped
count_dropped = 0
count_rebuild = 0
1000 continue
i = winio@('%ww%ca[DropTest]&')
i = winio@('%dr&',dropped_here)
i = winio@('Num rebuild %`rd&',count_rebuild)
i = winio@('Num FOund %`rd&',count_dropped)
i = winio@(' ')
if(i.eq.1)then
count_rebuild = count_rebuild + 1
go to 1000
endif
end
integer function dropped_here()
use mswin
integer:: count_rebuild,count_dropped
common/dr/count_rebuild,count_dropped
character*260:: dropped_file
dropped_file = clearwin_string@('dropped_file')
dropped_here = 1
count_dropped = count_dropped + 1
if(mod(count_dropped,3).eq.0)dropped_here = -1
return
end