Re: Gtk/Glade Beginner: widget lookup, text input etc



On Fri, 12 Dec 2003 00:32:18 +0530
Sukrit K Mehra <holysmoke amaltaas biz> wrote:

1. What exactly does lookup_widget do? 
If I have a widget called diaog1 in a file interface.c in order to 
destroy/hide/show it I need a pointer to it. Can I do something like 
GtkWidget *localname = lookup_widget(GtkWidget "External Name",
localname); On account of this, the following should work ...

        You do the following (assuming that in the fuction that you are doing
it in you have a widget which is part of the same tree of widgets as
the one you are looking for):

        GtkWidget *localwidget = lookup_widget (button, "dialog1");
        (assuming button is a GtkWidget * and is part of dialog1)

This will return the pointer to your dialog1 widget.

2. I have a form that comes up on activation of a menuitem. It has n
number of fields (gtk entry widgets). How do i take information for
them simulatenously at the click of a button in the form.
gtk_editable_get_chars, needs user to press enter at the end if used
with activate signal. OTOH if used with changed signal the output is
emitted as it occurs (by keystroke).

        You can use gtk_entry_get_text to do it:
        gchar *entry1_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry1));
        gchar *entry2_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry2));



-- Mitko Haralanov
voidtrance at comcast dot net
http://voidtrance.home.comcast.net
==========================================
As Will Rogers would have said, "There is no such things as a free
variable."



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