RE: [gtk-list] A more elegant way to get labels from buttons???



I think you could use the gtk_label_get() function to make it a little more
elegant, but as for the GTK_BUTTON(widget)->child part, I'm pretty sure that's
the only way of getting to the label - when you think about it, a
gtk_button_with_label_get function wouldn't actually be right, since a
button can hold many other types of widgets, it's not limited to just labels.
As for RTFM's, I've found the header files to be the most useful :)

On 08-Apr-98 Rick Forrester wrote:
> 
> I've probably managed to miss the pertinent data in testgtk.c or wherever,
> but 
> I need to extract the character string from the label on a button in a 
> callback.  What I've come up with (that works) is the following assignment:
> 
> void AlphaButtonCallback (GtkWidget *widget, gpointer data) {
>    char *str = GTK_LABEL(GTK_BUTTON(widget)->child)->label;
> 
> but I dislike depending on knowledge of the internals of a data structure. 
> Is 
> there an equivalent function call that I've missed?
> 
> RTFM's which list manual greatly appreciated.  Direct answers/comments 
> appreciated.
> 
> TIA
>    rickf
> 
> -- 
> Rick Forrister                 <Richard.Forrister@jpl.nasa.gov>
> 
> Opera: Greek word meaning "death by music".
>               --Anonymous
> 
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

--
Evan Lawrence



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