Re: Labels In Radio Buttons



Hello,

I've been inspired by the GTK+ tutorial (specifically,
http://www.gtk.org/tutorial/ch-widgetoverview.html#SEC-CASTING), and I think
I have an answer.

I think that because a GtkRadioButton is a descendant of GtkButton, you can
use casting to retrieve the label. This is better served in an example, so
have a look at the last line of this code example

Rather than:

GtkWidget *radio_button;
gchar *radio_button_label_text;
...
radio_button = gtk_radio_button_new_with_label(NULL, "This is my text");

/* This doesn't work: no label member in GtkRadioButton */
radio_button_label_text = GTK_TOGGLE_BUTTON(radio_button)->label;

/* This might work: there's a label member in GtkButton */
radio_button_label_text = GTK_BUTTON(radio_button)->label;

There's are a couple of guys in the office upstairs from mine that have
Linux installed, so I'll be hassling them to give this a try on their
machines at some point. Failing that, I'll find a solution when I get home
and away from these Windows machines, godammit! :-)

Good luck,

 - darren




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