> Seems to me that when I call the translate() method the 
> object mygl is no
> longer available. 

No - you maybe missed my second post on this? Your callback method is
definitely not finding the correct widget to call.

Your mygl widget is fine - you simply are not calling it.

I made a few crude hack to your code to correctly call mygl and all was
fine.

Though, for the record, your GL code is wrong, too and does not draw
what you think it draws...


> But is there a way of calling this method 
> without making
> this parse
> ((MainWindow*)v)->translate();  ? Or at least do it differently?

This parse (and the other one shown in your code) is wrong - it does not
find a widget of type "MainWindow", so casting what it does return (NULL
in this case, I think) to type MainWindow then calling for the
translate() method is bound to fail.

This method is a callback from a menu item, so in the callback the "w"
parameter can be cast to a menu object, and the "v" parameter will be
NULL in your case as you have not set it to anything.

What I suggest you do is make your MainWindow class derive for Fl_Window
- you have created a new class that holds various widgets, including an
Fl_Window.

But if you derive from Fl_Window, and make your menu, and the "mygl"
object be children of that window, then in your callback you can get the
parent of the menu and then cast that to the appropriate type to get
mygl as a child, then all should be well.


I haven't explained that very well... But what you have done in your
translate_cb() method is wriong, and that is where your crash is coming
from....





SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to