From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17211.55749.735106.919692 at karryall.dnsalias.org> Date: Thu, 29 Sep 2005 14:10:45 +0200 To: Anastasia Gornostaeva Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: mouse pointer and textview iterator In-Reply-To: <20050928123519.GA12331 at ermine.home> References: <20050928123519.GA12331 at ermine.home> Anastasia Gornostaeva [Wednesday 28 September 2005] : > > Hi. > > Is it possible to convert the button click on textview object to > its iterator? I want to point a tag object using right button > click and change its properties. you have to catch a button-press-event signal and then convert the widget coordinates of the click to coordinates in the text buffer. Someting like this: view#event#connect#button_press (fun ev -> if GdkEvent.Button.button ev = 3 then begin let x = GdkEvent.Button.x ev in let y = GdkEvent.Button.y ev in let w = GdkEvent.get_window ev in let (buffer_x, buffer_y) = view#window_to_buffer_coords ~tag:(view#get_window_type w) ~x ~y in let iter = view#get_iter_at_location ~x:buffer_x ~y:buffer_y in (* .... *) end ; false) -- Olivier