Re: Re: C++-classes.
- From: "David Larsson" <dls home se>
- To: jcf tpg com au
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Re: C++-classes.
- Date: Tue, 22 Oct 2002 10:55:14 +0200
All is not lost. You can do exactly what you >want. This is how:
class GtkClass
{
GtkWidget *button; // private by default
static void Test(); // no this pointer for
// static methods
public:
GtkClass();
};
GtkClass::GtkClass()
{
button = gtk_button_new();
gtk_signal_connect(GTK_OBJECT(button),
"clicked", GTK_SIGNAL_FUNC(&GtkClass::Test), 0); // C++ doesn't use NULL. It's a C macro.
}
Ah, then I came up to another problem. If you then want to modify the "calling" class variable, for example
the GtkWidget *button.
If you do a:
void GtkClass::Test()
{
gtk_widget_hide(button);
// or a GtkClass::button?
// or even call another method in GtkClass?
}
it doesn't seem to work. How can i fix this?
// David
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]