From: Olivier Andrieu MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Message-ID: <17706.44463.566927.771464 at karryall.dnsalias.org> Date: Mon, 9 Oct 2006 22:14:39 +0200 To: "Dmitry Bely" Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: Button accelerators In-Reply-To: <90823c940610091301p30cc7a77i7693d69cd6d13cd1 at mail.gmail.com> References: <90823c940610091016i2ec702c6i8085fa434cb6a82e at mail.gmail.com> <17706.41325.334205.592636@karryall.dnsalias.org> <90823c940610091301p30cc7a77i7693d69cd6d13cd1@mail.gmail.com> Content-Type: text/plain; charset=us-ascii Content-Length: 1095 Dmitry Bely [Tuesday 10 October 2006] : > > On 10/9/06, Olivier Andrieu wrote: > > > I have a dialog with OK and Cancel buttons: > > > > > > Now I would like to add Enter/ESC accelerators to Ok and > > > Cancel buttons respectively. How to do that? > > > > For enter, it's easy : > > ,---- > > | dialog#set_default_response `OK > > `---- > > Well, if GEdit.entry is active this does not work. Hmm > > For esc, it's a bit more complicated. It should work out of the box on > > a C gtk+ app, but not with lablgtk. It should be fixed in GTK+ 2.10 > > (it's bug #101293 in the GNOME bugzilla) but for previous versions you > > need to manually connect a signal : > > ,---- > > | dialog#connect#close (fun () -> d#response `CANCEL) > > `---- > > This works, thank you, but how to get the same for Enter? You could use the "activates-default" property of GEdit.entry: http://developer.gnome.org/doc/API/2.0/gtk/GtkEntry.html#GtkEntry--activates-default or connect the "activate" signal of the entry to generate the OK response. -- Olivier