Re: Regarding GdkEventButton



>I have text area and when I click on that I should get the current
>cursor position. So I am using gdk_button_press event for that.
>But when I click on that at some position, I get the cursor postion of
>the last event. that is If I have some text of 8 letters already in
>the text area, if i click at 7th position, it still gives me positon 0.
>Next time I click at position 5, it gives me positon 7. that is, it is
>giving the position of the cursor where it was last time . not the
>current cursor position..

no big suprise. since the cursor is moved in response to a button
press (or more likely, a button release), and your handler is
executing before the cursor has been moved. there are two solutions:

	  1) from your button event handler, 
	      install a 1-shot idle handler to find the cursor location
          2) use connect_after on button_release_event, which will
	      run your handler after the cursor has been moved

--p	       



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]