Re: [[glade--]Beginner question]

Murray Cumming wrote:

"Dennis, Joseph D" <DennisJD BATTELLE ORG> wrote:

I am writing a small application in C++ and want to put a gui front end on
it.  I found this tutorial ( ) for
Glade and C and have been trying to apply it to glademm and c++.  I am


trying to figure out how to write this function in c++:

void on_button1_clicked(GtkButton *button, gpointer user_data){

GtkWidget * label = lookup_widget(GTK_WIDGET(button), "label1");
GtkWidget * entry = lookup_widget(GTK_WIDGET(button), "entry1");

gchar output[50]="Hello ";

Apparently the lookup_widget() method only applies to C.  How can I pull


text out of the entry box and push it into the label in this function?

Thanks for your help.

I think you need libglademm, which might provide a widget lookup method. But
anway, whenever you've got a C GtkWhatever* you can get a Gtk::Whatever* by
using Gtk::wrap() - see the gtkmm FAQ.

No libglademm is an alternative to glademm. Using both does not make much sense.

libglademm loads the glade file at runtime, glademm generates C++ code at compile time.

Answering your question:

There is a user class associated with the window. This class should contain methods for every callback you define. Since these callbacks are member functions all widgets declared as protected or public (C++ visibility in glade) are available by their name (pointer). Simply take a look inside *_glade.hh (after you made the widgets protected).

Did you know about the glademm user's manual? It does not contain a tutorial but covers most of these questions.


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