Date: Thu, 9 Oct 2003 14:39:03 +0200 To: Olivier Andrieu Cc: Sven Luther , lablgtk at kaba.or.jp Subject: Re: changing the text of a button ? Message-ID: <20031009123903.GB20205 at iliana> References: <20031009112030.GA18869 at iliana> <16261.21992.20913.72044 at akasha.ijm.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <16261.21992.20913.72044 at akasha.ijm.jussieu.fr> From: Sven Luther On Thu, Oct 09, 2003 at 02:34:48PM +0200, Olivier Andrieu wrote: > Sven Luther [Thursday 9 October 2003] : > > > > Hello, > > > > I would like to change the text of a button, but have difficulties > > doing this. > > > > It seems to me that the button is a container, which contains a > > label as only child, and thus i tried to do this : > > It's a bit more complicated : when using stock items, the child is a > GtkAlignment which contains a GtkBox which contains an image and a > label ... > > Furthermore, the GtkButton widget has a "label" property, so changing > the child's label without changing this label isn't a good idea : the > old label could reappear later. > > > Any hint on doing so, or maybe a set_text method could be added to > > the button object ? > > gtkButton.props already has the label property defined. It's just not > wrapped in GButton : Ok. > Index: src/gButton.ml > =================================================================== > RCS file: /staff2/garrigue/repos/lablgtk/src/gButton.ml,v > retrieving revision 1.26 > diff -u -r1.26 gButton.ml > --- gButton.ml 21 Sep 2003 10:02:17 -0000 1.26 > +++ gButton.ml 9 Oct 2003 11:47:07 -0000 > @@ -14,6 +14,8 @@ > method clicked () = Button.clicked obj > method set_relief = set Button.P.relief obj > method relief = get Button.P.relief obj > + method set_label = set Button.P.label obj > + method label = get Button.P.label obj > method grab_default () = > set Widget.P.can_default obj true; > set Widget.P.has_default obj true > Index: src/gButton.mli > =================================================================== > RCS file: /staff2/garrigue/repos/lablgtk/src/gButton.mli,v > retrieving revision 1.24 > diff -u -r1.24 gButton.mli > --- gButton.mli 27 Sep 2003 13:42:19 -0000 1.24 > +++ gButton.mli 9 Oct 2003 11:47:07 -0000 > @@ -17,6 +17,8 @@ > method clicked : unit -> unit > method set_relief : Tags.relief_style -> unit > method relief : Tags.relief_style > + method set_label : string -> unit > + method label : string > method grab_default : unit -> unit > method event : event_ops > end Could this be added to a next release ? I will add it to the debian package of lablgtk2 in the meantime. Friendly, Sven Luther