From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16261.21992.20913.72044 at akasha.ijm.jussieu.fr> Date: Thu, 9 Oct 2003 14:34:48 +0200 To: Sven Luther Cc: lablgtk at kaba.or.jp Subject: Re: changing the text of a button ? In-Reply-To: <20031009112030.GA18869 at iliana> References: <20031009112030.GA18869 at iliana> 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 : 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 -- Olivier