Re: widgets within widgets
- From: Carlos Pereira <carlos pehoe civil ist utl pt>
- To: gtk-app-devel-list gnome org
- Subject: Re: widgets within widgets
- Date: Tue, 24 Apr 2001 19:18:10 +0100
I`m currently writing a GTK app where i have a GTK_TEXT widget inside
a GTK_BOX, which in turn is in a GTK_NOTEBOOK page. When the user
switches pages on the notebook, i need to be able to access the GTK_TEXT
widget in the currently active notebook page. How do i do this?
See the following examples, if you have more than one
object inside the box just use set_data/get_data,
it's simple and clean.
Carlos
/*You can access the box of the current page with this:*/
gint page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
GtkWidget* vbox = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page);
/*If you have only Gtk_Text inside the box,
you might get access to it with this, try it:*/
gtk_text = GTK_BIN (vbox)->child;
/*The switch callback may look like this example: */
static void static_switch (GtkNotebook *notebook,
GtkNotebookPage *page, guint tag, gpointer data)
{
app_window *window;
GtkWidget *dialog, *vbox, *text;
vbox = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), tag);
window = APP_CAST_WINDOW data;
dialog = window->dialog0;
text = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "my_text");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]