Lay a canvas over the HTMLViewer. Make sure not to make it a child of the HTMLViewer (the HTMLViewer would be outlined red). Drop it over the window, make it larger than the HTMLViewer and slide it carefully over.
Add the following events to the canvas :
Sub Open()
Me.AcceptFileDrop("")
End Sub
and
Sub DropObject(obj As DragItem, action As Integer)
obj = Nil
End Sub
Indeed, under Windows the canvas does not let clicks go through with MouseDown and MouseWheel returning False
The HTMLViewer is a black box that does not offer any event or properties to distinguish between an URL dropped over it and a click or a LoadURL. There does not seem to be any way to prevent dropped shortcuts to open. Sorry. You found a sad Xojo limitation with no workaround.
I filed feature request #33226 to ask that HTMLViewer not accept file drop as default, as the method HTMLViewer.AcceptFileDrop is here to enable it, and is rendered the method purposeless.
I see that you had reviewed the 16087 bug report in 2011
True in CancelLoad simply prevents ALL loading to take place
[quote=80734:@Michel Bujardet]
True in CancelLoad simply prevents ALL loading to take place :([/quote]
Cancel Load cancels loading whatever URLs you return true for
So you can look at the URL and determine IF you want to allow it to load or not
The reason I asked is I quickly whipped up a small example and did not return true in candle load & I could drag & drop whatever files from my Windows 7 desktop
When I simply returned true all the time none of the them would load
Guess what I just found out ? Under Windows, when Rendered is set to Webkit, HTMLViewer stops accepting file drop. The solution was here all along, just with a small setting
Mac accepts files drop whatever the Renderer, so Shao Sean solution or the canvas overlay workaround remain necessary.
Linux HTMLVIewer simply does not accept file drop…
An aside, @Norman, I haven’t used them since Realbasic, and my computers not available right now, but are the undocumented _ (underscored) functions still available for HTMLViewer (like cancel javascript errors etc)?
[quote=80818:@Matthew Combatti]An aside, @Norman, I haven’t used them since Realbasic, and my computers not available right now, but are the undocumented _ (underscored) functions still available for HTMLViewer (like cancel javascript errors etc)?[/quote]
You should never use those in any code anywhere
They are internal and should be private
The OP uses Windows, but while I was experimenting with Linux, I fiddled with the HTMLViewer drop file. And found fragmented issues (smile).
In Ubuntu 12.10, the HTMLViewer does not accept shortcuts at all.
In Fedora, same thing as Windows : shortcut drop opens the url, and the canvas overlay does not trap the file drop. But it traps click and mouse wheel, even though I return False in MouseDown and MouseWheel.
In Linux Mint 16 “petra” when a shortcut is brought over the HTMLViewer the cursor shows the file will be opened, but nothing happens. Even with HTMLViewer.AcceptFileDrop()
All these results happen with native renderer. Curiously, all these distributions use FireFox, but behavior changes.
In all these distributions Shao Sean example code does not compile : an indeterminate ProgressBar shows, then the IDE shows the code is running, but the debug app is not launched.
I use that code in my HTMLViewer sub-class and know that it does work on all three platforms, but I only use the WebKit renderer as using Native on Windows gives different results in my program… There is one thing though that I forgot when I did that sample code, there is one time where the code does not work and you will need to trap the CancelLoad event… (basically it happens when someone drops a file on the viewer that is not part of the DOM area)…