Re: Change Button Label
- From: Luciano Chavez <lnx1138 us ibm com>
- To: gtk-list gnome org
- Subject: Re: Change Button Label
- Date: 07 Oct 2002 09:35:51 -0500
On Mon, 2002-10-07 at 08:08, Amit Jain wrote:
>
> Hi All
> I want to change label of a button.I got success in changing it but unable to understand the meaning of that particular line which is written below
> GTK_LABEL(GTK_BIN(button)->child)
> Why should i first typecast button into GTK_BIN and again convert it into button from GTK_BIN(button)->child.
> I guess GTK_BIN(button)->child gives button object.am i right or doing some mistake in interpreting the meaning of it.
>
A GtkButton is a subclass of GtkBin. A GtkBin is a container subclass
that contains only one child object (pointed to by the child field). So
when you cast the button with GTK_BIN, you were doing this to access the
child object. The child of a button is typically a GtkLabel but does not
have to be. It could be a pixmap or a box containing a pixmap and a
label. Unless you're positive its a label, you may want to test the
child widget with a GTK_IS_LABEL(GTK_BIN(button)->child) before casting
it as GTK_LABEL just to avoid GTK warnings.
--
regards,
Luciano Chavez
lnx1138 us ibm com
http://evms.sourceforge.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]