Re: Callback to parent dialog



Thanks for info but I think I found an easier way by simply writing a small interface class to call back to the owner class. Seems to work okay.

Nalin Singal wrote:
If you are writing this code in a Gtk::something class
or a class derived from one then you need to replace
"this" with "this->gobj()". And GtkWidget is correct.
Gtk::Widget is a Gtkmm object which is actually a
class wrapped around the underlying GtkWidget.
gtk_widget_toplevel() returns a GtkWidget* NOT a
Gtk::Widget*.  Also gtk_widget_toplevel() takes a
GtkWidget* not a Gtk::Widget*. This is the reason for
replacing "this". As someone else pointed out you are
mixing Gtk+ code and Gtkmm code (or C code and C++
code).
-Nalin

--- John Taber <jtaber johntaber net> wrote:


Still having some trouble (btw GtkWidget needs to be
Gtk::Widget) - it doesn't like "this", etc. Wondering if it would be easier to just pass in a void pointer and then typecast it?

Nalin Singal wrote:

Maybe you need to do something like this:

GtkWidget* toplevel =

gtk_widget_get_toplevel(this);

if(GTK_WIDGET_TOPLEVEL(toplevel)) {
 Gtk::GtkWidget* wrappedTL = wrap(topLevel, t/f);
 wrappedTL->editDialogWHATEVER);
}

There is a slight difference between gtk and

gtkmm.

gtk objects can't be directly converted to gtkmm

or

vice-versa. You need to call the wrap function to

go

one way and gobj() function if you want to go the
other way.

-Nalin

--- John Taber <jtaber johntaber net> wrote:



I've tried the following but it's not right. Can
someone help out - thks.

Gtk::GtkWidget* toplevel =
gtk_widget_get_toplevel(this);
if (GTK_WIDGET_TOPLEVEL (toplevel)) {
 toplevel->editDialog(data);
}


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list





		


__________________________________________________________

How much free photo storage do you get? Store your

friends 'n family snaps for FREE with Yahoo! Photos
http://in.photos.yahoo.com





	

	
		
__________________________________________________________
Free antispam, antivirus and 1GB to save all your messages
Only in Yahoo! Mail: http://in.mail.yahoo.com





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