I’ve worked on the original sample and updated the gist:
With some exceptions, this works on OS X, but running it in Windows
produces disappointing results.
I’ll point out where I’m having problems. Would you let me know if I’m
doing something wrong, or if these are bugs in wxRuby?
I’m just going to go through the file line by line and comment.
This isn’t so important, but is at the top of the file, so gets
commented on first. I’ve worked up a basic DragResultHandler, it would
be nice if some form of this were included in wxRuby.
I don’t get a sunken border on Windows. It looks nice on OS X, but
Windows just has a flat featureless plane for the drop targets.
I don’t have to call refresh on OS X for the backgrounds to light up,
but Windows doesn’t do anything unless I call refresh. Is this expected?
This doesn’t work on Windows or OS X. I get a “Wrong Argument” error. It
looks like the documentation says you should be able to do this, but
I’ve tried several permutations, and none of them works.
On Windows, the give_feedback method is only called consistently when
the pointer is over the drop targets during a drag operation. It is
called intermittently when over the drop sources, and not at all
anywhere else. This works perfectly on OS X.
This is like trying to create a new image on line 131. The documentation
seems to say I should be able to do this, but it gives me an argument
error as well. Resorting to setting the alpha pixel-by-pixel as I do on
181-185 works, but it is ugly.
I expected to just set the hotspot to half the width of the image, and
the full height of the image to get the image floating above the cursor.
This just doesn’t work. I have to use these non-sensical values to get
the effect I want on OS X. On Windows, the result is inconsistent,
sometimes I more-or-less get the effect I want, and other times the
image is way off to the side and down from where it should be, and other
times it is way off to the side and up from where it should be.
Works perfectly on OS X. On Windows, after I drag/drop one image, and I
then attempt to drag another image, if I move the pointer around “too
much” the program segfaults at this line. I can drag the image around
all I want on the first drag operation, but the second one always
segfaults when I move the pointer around “too much”.
As with the other mention of refresh above, I only have to call this on
Windows. Seems like I shouldn’t have to call it at all.
Lastly, a problem on OS X is that after a drag/drop operation, and
clearing the dialog, I have to click once anywhere in the window before
I can initiate another drag/drop. I thought it might be a focus problem,
so I tried different methods of resetting the focus, but it doesn’t seem
to make a difference. If I don’t use the MessageDialog, that is, I just
replace the dialog with a ‘puts’ in the event handler, I don’t have that
problem. This is only a problem on OS X.
Again, I’m unsure if I’m doing something wrong, or if these are bugs in
wxRuby, any pointers would be much appreciated.
Just a quick note on the Gist, you may notice I’ve included the image in
it now so you don’t have to go grab it from somewhere else.
Also, if this helps, on OS X, I’m using wxRuby 2.0.0, ruby 1.8.7
(2008-08-11 patchlevel 72) [i686-darwin9], built from ports, and on
Windows I’m using the same version of wxRuby and ruby 1.8.7 (2008-08-11
patchlevel 72) [i386-mswin32], which I downloaded from the Ruby website.
Since I’m going to use my template for packaging/distribution, using a
different ruby version wouldn’t be that much of a problem. Oh, and I’m
running Windows under Parallels 4 on OS X for these tests, if that makes