I’m working on examples aimed at kids for Linux and I’ve run into an oddity fir ListBoxes and TextFields - the DropObject action doesn’t seem to fire. I’ve set things up and the code works as expected under OS X, but copying the same ode to the Linux system just ignores the drop. Happens (or doesn’t as the case may be ) under 2013r4.1 and 2016r3.
Further research - In the Xojo example I mention above, there’s no “AcceptFileDrop” assigned to the app at all. Unfortunately, I need to restrict drop types, so I do use them as part of the demo code. Is it possible that the issue is related to the fact that a Linux app doesn’t get its File Types assigned in debug builds and the type lookup fails?
If I add “AcceptFileDrop(”")" to the Window’s Open event, I do get the DropObject event call on the Window. However, that same entry in the ListBox’s Open event does not see the DropObject Event to fire in the ListBox.
For me “AcceptFileDrop(”")" in listbox.open works (Ubuntu 16.04), I do restrict filetypes in DropObject
something like this
If obj.FolderItemAvailable Then
if right(obj.FolderItem.Name, 4) = ".mp4" _
or right(obj.FolderItem.Name, 4) = ".mp3" then
Me.AddRow(obj.FolderItem.Name)
Me.RowTag(Me.LastIndex) = obj.FolderItem
End If
End If
[quote=287691:@Norman Palardy]<https://xojo.com/issue/43602>
probably related to the underlying issue[/quote]
Possibly. Since the Open File dialog doesn’t show any files when the type is “Special/Any”, this may be tied to the filetypes set.
I’ll test by removing the Filetypes file and see if that sorts the drop.
But … why does the window level get the drop if I set AcceptFileDrop?
Okay - revisiting this and I have discovered what is occurring - the drop target (a listbox) was embedded within a GroupBox. While this layout works on OS X and Windows, it is somehow masking a number of events in a listbox on Linux.
Because I needed to group the controls in this example, I swapped out the GroupBox for a Canvas and simply added a background image that mimics the GroupBox’s outline.
I’ll test this under newer Xojo versions to see if we need to add this to the current bug reports.