Re: [gtk-list] NEWBIE: Getting a Handle to an entry.



One solution (of many) is to attach data to the button widget.


gtk_object_set_data(GTK_OBJECT(button),"WIDGET",&address_of_widget)

You can then retrieve the data from the widget (which is passed to the callback
function) using

address_of_widget = gtk_object_get_data(GTK_OBJECT(widget),"WIDGET")

(Semantics may be slightly wrong - conceptually it's right)


Matt Long wrote:

> I am building a dialog based application in which there are three text
> fields (entries). I am trying to implement a Clear button that clears
> all of those fields. I understand how to use gtk_signal_connect to
> connect to a callback function and pass data (which would be an entry)
> to that callback, but I am unsure as to how I can pass three entries to
> that callback so that I can set them all to an empty string.
>
> I would prefer to learn how to get a handle to the particular object
> whether entry or anything else (e.g. checkbox, radio, etc.). I am
> guessing that, if it is actually possible, you can do this by accessing
> the children of the parent window and then testing for the Widget type,
> but I am not sure how to do that. I can't find anything in the GTK
> Tutorial that explains
>
> Any pointers, tips, etc.
>
> Thanks in advance.
>
> -Matt
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

--
Kent Schumacher

Structural Wood Corporation
4000 Labore Rd.
St. Paul, MN 55110

Phone: (651) 426-8111
Fax: (651) 426-6859
e-mail: kent@structural-wood.com





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