|
|
Regarding passing window "pointers" from one file to another, I must thank you for assisting me in this endeavour. It works well now that I understand the use of "new", begin() and end(). I do note that the text _expression_ in each instance of my declared windows only appears for the first window....or I may be missing something. Is there a way to easily have a text at the top of each window which would describe the data that will be displayed? I did look at Fl_Text_Display but it seemed rather to be an overkill. It would be good to hear your thoughts. Take care.
The objects should work in your first example. There may be a problem with the destructor assuming other things have not been destroyed. Generally though when using objects it works better if they are local or local static variables in functions, this defers the constructor until they are first used. Something like this is supposed to work:
main() { Fl_Window w1(....); some_func(w1); }
some_func(Fl_Window& w) { w.show(); }
>So when I now, as you counciled, declare all the Windows globally such as >Fl_Window w1(5,198,600,275,"Tester"); This is why we want to see a program, not "snippets" with text. We will "guess" what you're doing and be at odds ...
I interpreted what you did differently from Greg. I think you did:
File1:
Fl_Window w1(5,198,600,275,"Tester"); // note: declared and created globally main() { w1.show() }
File2: extern Fl_Window w1;
some_func() { w1.hide() }
To me, the issue I think I'm seeing is you are trying to use "objects" and not pointers. I think the error you are getting at program shutdown is FLTK trying to destroy the FL_Window instances you created globally, and that can't be done. FLTK is a C library, not a C++ library, so it's best if you work with pointers.
The approach I would use is:
File1: Fl_Window *w1; main() { w1 = new Fl_Window(5, 198, 600, 275, "Tester"); // note: declared globally, allocated ON THE HEAP w1->hide(); // pointer syntax }
File2: extern Fl_Window *w1; // extern pointer
some_func() { w1->hide(); // pointer syntax }
Kevin
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/ca5666eb-c141-4048-8742-9b91d3e137fcn%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "fltk.general" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fltkgeneral/uDe3loc7qBY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAL-8oAjD%2BNPNzsHzUrYJFdwdnXPevsgtqKKXhEytn5LZCe%2BGrQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAAmyU3bXP7tbHnqi%3DJVLw3Dr_MxssADiNX98FmrusauFOFmm8A%40mail.gmail.com.
[ Direct Link to Message ] | |
|
| |