Re: [gtk-list] Re: NEWBIE: Getting a Handle to an entry.
- From: Matt Long <matt long wcom com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: NEWBIE: Getting a Handle to an entry.
- Date: Fri, 06 Aug 1999 12:55:13 -0600
Sorry Tim. I should have mentioned that I didn't wnat to use global variables.
Thanks.
-Matt
"Timothy M. Shead" wrote:
> Maybe I'm misunderstanding the question, but it sounds like the "handle"
> you're looking for is the widget pointer that's returned when you create the
> widget ... why not store it, and use it in the callback for your "Clear"
> button:
>
> // Declaring the entries as globals
> GtkEntry* entry1;
> GtkEntry* entry2;
> GtkEntry* entry3;
>
> // Creating the entries
> void CreateMyDialog()
> {
> entry1 = gtk_entry_new();
> entry2 = gtk_entry_new();
> entry3 = gtk_entry_new();
>
> // Other initialization here
> }
>
> // The "Clear" button callback
> void OnClearClicked()
> {
> gtk_entry_set_text(entry1, "");
> gtk_entry_set_text(entry2, "");
> gtk_entry_set_text(entry3, "");
> }
>
> Cheerio,
> Tim Shead
>
> > 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
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]