Re: How to show new window?



It's easy (and it's not gtk/gtkmm per se, it's plain C/C++). In
winOscilloscope.hh

#include "winConfiguration.hh"

and in the winOscilloscope class have a member winConfiguration (either
object, or pointer). If you have a pointer, you need to allocate it. As it
stands, this is done in main. Main doesn't really need to know about
winConfiguration, but winOscilloscope does. Glade can't know that, so it
defines both windows in main, but you can put the second one wherever you
want.

Also, the windows built by glade don't have a constructor. It leaves it to
you to write one, if needed. That's a good place to create GC, allocate
colors, etc. This is a good place to have winConfiguration allocated, if
you defined it as a pointer.

Ahh, ok, so the secret is to move the second window into a function in the class
of the first window. I think I have it mostly working now. Thanks!

Is there another secret about how to share data between the two windows? I suppose
I could write class functions to pass data in and out, but is there a better way? I'd
like to have Window #2 be a configuration dialog, so it will need to read/write the same
configuration data that Window #1 is using. I could somehow pass a pointer to a
seperate configuration class, but I don't want to make this more complicated than it
needs to be.

Thanks, all

  - Jeff


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]