Re: button label problem



Here is one idea.

Use a global variable to keep track of which label you have on, and keep
the label global as well so you can change it.

1.- gtk_signal_connect to connect the "clicked" signal to a callback.

2.- The callback receives the button widget as an argument.

3.- gtk_label_set_text


I know that there's a better solution, but I can't think of it.  I really
hate global variables.  Perhaps you can improve upon my suggestion.

Perhaps you can try to obtian the label from the button, and get the text
from the label.  This would eliminate both globals.

Daniel.

On Wed, 14 Aug 2002 vyadav cdotd ernet in wrote:

> hi ..
>
>    yeah exactly i want it....
>
>    can u help me..
>
>   thanx..
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Wed, 14 Aug 2002, Daniel Carrera wrote:
>
> >
> > I'm not sure what you want.  Do you want the button to change back and
> > forth between two labels each time you click?
> >
> > Daniel
> >
> > On Wed, 14 Aug 2002 vyadav cdotd ernet in wrote:
> >
> > >
> > >    hi...
> > >
> > >         thanx for ur help....
> > >
> > >      i want to ask one more thing..if i changed the label by clicking
> > > once..how can i change it again on next click...
> > >
> > >    thanx..in advance...
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Tue, 13 Aug 2002, Olexiy Avramchenko wrote:
> > >
> > > > vyadav cdotd ernet in wrote:
> > > >
> > > > >   hi..
> > > > >
> > > > >   i did like it..but i got undefined reference of "gtk_button_set_label"
> > > > >
> > > > >    then what should i do....
> > > > >
> > > > >      thanx...
> > > > >
> > > > Oops, you're using gtk+-1.2, the gtk_button_set_label function is from
> > > > gtk+-2.0 library.
> > > > Try this:
> > > > ---
> > > > gtk_label_set_text(GTK_LABEL(GTK_BIN(button)->child), label);
> > > > ---
> > > > instead of
> > > >
> > > > ---
> > > > gtk_button_set_label(...)
> > > > ---
> > > >
> > > > Olexiy
> > > >
> > > >
> > > > _______________________________________________
> > > > gtk-list mailing list
> > > > gtk-list gnome org
> > > > http://mail.gnome.org/mailman/listinfo/gtk-list
> > > >
> > > >
> > >
> > >
> > > _______________________________________________
> > > gtk-list mailing list
> > > gtk-list gnome org
> > > http://mail.gnome.org/mailman/listinfo/gtk-list
> > >
> >
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
> >
>
>




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