[fxruby-users] Questions on cursors

Ronald Pijnacker pijnacker at dse.nl
Fri Jul 14 14:18:35 EDT 2006

> > I've tried this approach, however setting the default cursor or the drag
> > cursor on a FXGLCanvas consistently crashes the application.
> Probably, with the message:
> 	"Cursor has not been created yet."
> It is necessary to explicitly call create() on resources which didn't
> yet exist as part of the widget hierarchy at the time that create() was
> called on FXApp.

You're right on the spot! Great.
I did not see that message, though. 
> > > 3) These are really "stock cursors" and they can be changed only BEFORE
> > >    creating any widgets; when a widget is created, it gets its cursor
> > >    from FXApp; you can use this to install your own custom cursor-theme
> > >    if you need.  It affects ALL widgets.
> >  
> > That is what I intend to do: override the defaults for all the widgets.
> > I do this directly after creating the application and before creating
> > the main window (or any other widgets). In itself, it works fine, it is
> > just crashing the program on program exit. That only happens when I set
> > the same cursor for two different defaults, so my guess would be that
> > there is a double free/release executed somewhere.
> That would be my guess, yes.  You'd need two instances of the same cursor
> in the case you want two originally different cursors to display the same
> glyph.
Somehow, FXCursor.dup does not seem to work. Can I copy the cursor somehow
(except for the perfectly obvious choice).

> > >    Rather than changing FXApp's cursors, I recommend changing the cursor
> > >    of a specific widget only, using setDefaultCursor() and setDragCursor().
> > > 
> > > 4) This is an FXRuby question for Lyle I think; I can only say that in FOX
> > >    itself there's only 1 parameter, the cursor...
> > 
> > You are right. I was looking at the setDefaultCursor for FXApp, which
> > has two parameters.
> > 
> > Still do not know where all the crashes come from, though. Did you have
> > much success with setting non-stock cursors?
> It should work fine; just keep in mind that FXApp thinks it "owns" them
> and thus will try to manage the lifetime of these resources.  They're
> normally not changed by applications, unless for the purpose of theming
> cursor collections, perhaps.
That is sort-of what I am trying to do. With the .create() in place it
works like a charm. Thanks for the tip.

The only problem left is that of the missing mouse-up events. But I think I
can work around that.



More information about the fxruby-users mailing list