Thinking out of the box is sometimes thinking about the box. All along, I tried to draw a rectangle around the border of the canvas, without realizing that I could simply use the border property of the rectangle I had rested the canvas over. This works perfectly and avoids all unnecessary extra manipulations of images or extra code in Paint.
Function DragEnter(obj As DragItem, action As Integer) As Boolean
me.parent = nil
Rectangle5.width = me.width+4
Rectangle5.Height = me.Height+4
Rectangle5.top = me.top-2
Rectangle5.left = me.left-2
Rectangle5.BorderWidth = 2
Rectangle5.BottomRightColor = &c00F6FF00
Rectangle5.TopLeftColor = &c00F6FF00
End Function
Sub DragExit(obj As DragItem, action As Integer)
Rectangle5.width = me.width
Rectangle5.Height = me.Height
Rectangle5.top = me.top
Rectangle5.left = me.left
Rectangle5.BorderWidth = 1
Rectangle5.BottomRightColor = &c00000000
Rectangle5.TopLeftColor = &c00000000
End Sub
Sub DropObject(obj As DragItem, action As Integer)
Rectangle5.width = me.width
Rectangle5.Height = me.Height
Rectangle5.top = me.top
Rectangle5.left = me.left
Rectangle5.BorderWidth = 1
Rectangle5.BottomRightColor = &c00000000
Rectangle5.TopLeftColor = &c00000000
if obj.PictureAvailable Then
teamPic = obj.Picture
elseif obj.FolderItemAvailable Then
teamPic = Picture.Open(obj.FolderItem)
end if
End Sub
Finally, I tried again to find some mention of the selection frame appearing in a canvas when a file is dragged over it in Carbon in the OS X Human Interface Guidelines at https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html
The only place where a file drop is mentioned is for picture files, and the recommended control is the ImageWell. No mention of any Focus Ring or selection frame, or drag border as I call it, occurring when a file is dragged over.
I guess this long thread is now mostly complete. I am glad it helped me understand better the issues around setting the focus in DragEnter. And especially to have been able to study the mystery of different behaviors of the Cocoa framework concerning the Focus Ring depending on the nature of the dragged file and find out that only picture files allowed an immediate change in focus. Also, to corner the SetFocus working only once for each application activation, which indeed looks terribly much like a Xojo bug. Knowing all these aspects, or studying them in a dispassionate way, would have spared flaring tempers and misunderstandings which got in the way of getting to the truth.
Now, I believe I may know a thing or two about what we talked about…