Subject: binding events with glade From: Gabriel de Perthuis To: lablgtk at math.nagoya-u.ac.jp Content-Type: text/plain Date: Tue, 05 Apr 2005 14:01:25 +0200 Message-Id: <1112702486.22493.84.camel at localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Hello, Coming from C, I very much appreciate the ease of development with lablgtk. Here is a suggestion to improve it. I've seen two ways of binding events to a glade widget: one is to simply use widget#connect#event handler, and the other is to use self#bind ~name:"signal_name" ~callback:handler . The former does not use the signals declared within the glade xml, whereas the other does but relies on a string. Here is a third option which, a bit like autoconnect in C, requires no action on the user part. It requires a tweak to code generation so that code is generated for named events as well as named widgets. The generated code declares a virtual method for each event, and an initialiser that binds that method to the event. method virtual button_clicked : 'a initializer self#bind ~name:"button_clicked" ~callback:self#button_clicked I'll try (if I find time, if it isn't too difficult...) to implement this in lablgladecc.ml, so please tell me what you think about it.