On Tue, 2010-08-03 at 11:32 +0100, Richard Senior wrote:
> public boolean onButtonReleaseEvent(Widget w, EventButton e) {
[snip]
> It does work, apart from one case. If I make a selection and then click
> _inside_ the selection with the mouse, the selection clears but in the
> handler above the buffer.getHasSelection() returns true. So my
> cut/copy/delete buttons remain enabled until I click again or press a key.
> ...
> Is there another event I could use?
I've always used Widget.ButtonPressEvent for this sort of thing; you
want to do your thing before GTK's default handers get to it.
[Widget.ButtonReleaseEvent is when you let go of the mouse, not when you
click it. I imagine you knew that, but you can sometimes fake yourself
our with what the right behaviour to hook into is. Same goes for key
presses; I work with Widget.KeyPressEvent most of the time, only rarely
does one need Widget.KeyReleaseEvent]
Anyway, give it a try and see how you go.
AfC
Sydney
|