Re: [[glade--]Beginner question]
- From: Christof Petig <christof petig-baender de>
- To: Murray Cumming <murrayc usa net>
- Cc: Dennis Joseph D <DennisJD BATTELLE ORG>, "glademm-list gnome org" <glademm-list gnome org>
- Subject: Re: [[glade--]Beginner question]
- Date: Thu, 07 Feb 2002 08:53:41 +0100
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 (http://writelinux.com/glade/index.php ) for
Glade and C and have been trying to apply it to glademm and c++. I am
stuck
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 ";
strcat(output,gtk_entry_get_text(GTK_ENTRY(entry)));
gtk_label_set_text(GTK_LABEL(label),output);
}
Apparently the lookup_widget() method only applies to C. How can I pull
the
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.
Christof
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]