[Glade-users] Using status bar
- From: damon ximian com (Damon Chaplin)
- Subject: [Glade-users] Using status bar
- Date: Mon, 14 May 2001 16:16:59 -0400
Brian Kerhin wrote:
Hello all,
I'm going to make a new front end for my rio500 and then (after gaining some
experiance) attempt to help w/ the current grio500 project (or maybe they'll
just take my front end and call it a day :). I've got a book that took me
through getting info onto a dialog box, but I would like to add text to the
appbar (GnomeAppBar) on the bottom of a Default Gnome Application Window. I'm
having problems getting a pointer to it. I know I need lookup_widget, but what
would I use? I've attempted the following:
GtkWidget *appbar1;
appbar1 = lookup_widget(GTK_WIDGET(button), "appbar1");
I've also tried GTK_WIDGET(app1) and GTK_WIDGET(window1), all give me wonderful
compile errors. My book didn't give me much to go on here (Professional Linux
Programming, Wrox) so I look to you.
You can only use lookup_widget() to get a pointer to a widget within
the same window, e.g. the same window that 'button' is in in your code above.
To get pointers to widgets in other windows the FAQ may help a bit:
4.6 How do I get a pointer to a widget in another window?
You need to keep track of pointers to all your toplevel windows.
For simple applications you can just use global variables to store these
pointers.
For more complicated applications you can use the gtk_object_set_data() and
related functions to store a pointer to one window inside another window.
For example, if you want to create a dialog which needs to access widgets in
the main window you can do this:
dialog = create_dialog1 (); /* Call the function generated by Glade. */
gtk_object_set_data (GTK_OBJECT (dialog), "main_window", main_window);
Then when you need to access the main window from within the dialog code,
you can do this:
main_window = gtk_object_get_data (GTK_OBJECT (dialog), "main_window");
NOTE: You need to be careful to ensure that the pointer is always valid.
If the window being pointed to is destroyed, make sure you no longer use the
pointer to it or your application may crash.
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]