Re: how do i use lookup_widget()

Date view Thread view Subject view Author view

From: Anthony Tekatch (anthony.tekatch@sympatico.ca)
Date: Sun Nov 07 1999 - 18:11:44 EST


> How do i use lookup_widget(). I have been searching the gtk+ FAQ.
> Is there a Glade FAQ?

There is a Glade FAQ in the directory that you unpacked the glade source code
to. Mine is located in /home/anthony/glade-0.5.3/

Here is the tidbit of information that explains lookup_widget:
===================================================================
3.4 How do I get a pointer to a widget from within a signal handler?

Use the lookup_widget() function provided. (It can be found in support.c)

You pass it a pointer to any widget in a window, and the name of the widget
that you want to get. Usually in signal handlers you can use the first argument
to the signal handler as the first parameter to lookup_widget(), e.g.

void
on_button1_clicked (GtkButton *button,
                                        gpointer user_data)
{
  GtkWidget *entry1;

  entry1 = lookup_widget (GTK_WIDGET (button), "entry1");

  ...
}
===================================================================

Here is the reference information from support.c that explains what
lookup_widget needs and returns:
===================================================================
 GtkWidget* lookup_widget (GtkWidget *widget,
                           const gchar *widget_name)
 { .... }
===================================================================

> I want to put text in a text box. Let's call it text2. Shall i do
> something like this.
>
> some_var_maybe = lookup_widget( what_to_write_here, text2 );

some_var_maybe is the pointer to the actual text2 widget that you want to put
your text into.

what_to_write_here is the pointer of any widget in the window that your
text2 widget is located in.

text2 can be represented as text within quotations in your call (like
"textbutton").

I think you would then do this:
  gtk_text_insert(GTK_TEXT (some_var_maybe), .... etc

PS. I just learned this today so I hope it came across OK.

--
Anthony

+---------------------------------------------------------------------+ To unsubscribe from this list, send a message to majordomo@ncis.pn.org with the line "unsubscribe glade-devel" in the body of the message.


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Aug 01 2000 - 19:25:33 EDT