[fxruby-users] handling both SEL_LEFTBUTTON[PRESS|RELEASE], and SEL_DOUBLECLICK

Lyle Johnson lyle at lylejohnson.name
Tue Dec 29 12:08:26 EST 2009

On Thu, Dec 24, 2009 at 9:00 AM, Joey Kinsella
<jkinsella at ancillaryservices.com> wrote:

> Does anyone know if it is possible to connect to both a
> SEL_LEFTBUTTONPRESS (SEL_BUTTONRELEASE), and still be able to connect to a
> SEL_DOUBLECLICK? I am using an FXIconList, and I've implemented a basic
> pseudo `drag-n-drop', kind of thing... using SEL_LEFTBUTTONPRESS, and
> SEL_LEFTBUTTONRELEASE. I want to also handle a SEL_DOUBLECLICK so that a
> dialog will popup when they double click on an item. However, it appears
> that since I am already connecting to SEL_BUTTONPRESS/RELEASE that
> SEL_DOUBLECLICK is never getting triggered. (or atleast that is my
> assumption.) Is there a way around this? Or do I have to some how implement
> my own kind of SEL_DOUBLECLICK based on the FXEvent structure that is passed
> to SEL_LEFTBUTTONPRESS? (ie: if(data.click_count == 2) ; do_this() ; else ;
> do_that() ; end) I feel like that is rather hackish, and I'd rather not, if
> I don't have to.

The default SEL_LEFTBUTTONRELEASE handler for the FXIconList is where
a SEL_DOUBLECLICKED message is usually generated, and (as you
supposed), it's checking the FXEvent struct to see what the click
count is.

You might be able to get this to work by ensuring that your
SEL_LEFTBUTTONRELEASE handler evaluates to false, e.g.

    iconList.connect(SEL_LEFTBUTTONRELEASE) do
      # ... something ...

This will cause the default SEL_LEFTBUTTONRELEASE handler to pick up
where you left off.

Hope this helps,


More information about the fxruby-users mailing list