Hi Mark,

Thanks very much for this.  This event structure looks intuitively right.  I
need to work out how to implement it.

There is no intention that the second click of a double should negate a
preceding single click.  A double click is a more forceful single click, or
if you like, the click to raise the popup and click to OK it (with defaults)
all in one. As the application is voice-activated at this point, it needs a
key-board alternative to the voice command, and we can't have pop-ups during
surgery because answering detailed questions on a pop-up would disturb the
flow of the surgery. 

However, I'll watch my users in action to see if there is any additional
psychopathy evident at the user interface :)  It can always be done better,
the trick is knowing where to stop.

The main point is that I'm using EVT_LIST_ITEM_ACTIVATED instead of
EVT_LEFT_DCLICK, which is probably a mistake.

Thanks again.

Regards

Steve.



-----Original Message-----
From: Mark Dootson [mailto:mark.doot...@znix.com] 
Sent: 05 February 2013 02:32
To: wxperl-users@perl.org
Subject: Re: Getting information from EVT_LIST_ITEM_RIGHT_CLICK

Hi,

The wxListCtrl events are created to emulate standard controls.

I think it is fairly standard that a single click event would always 
precede a double click event. It is an operating system default normally 
that if a second click is received within a pre-determined time, then a 
double click event is raised. I'm not aware of any OS where a double 
click negates the preceding single click?

Some OS's do, of course allow you to set behaviour where in certain 
contexts a single click is enough to 'Activate' an item but I've never 
seen something where a double click prevents the previous single click 
from happening.

EVT_LIST_ITEM_SELECTED and EVT_LIST_ITEM_ACTIVATED do pretty much what 
it says on the tin. They are not therefore limited to being raised by 
mouse clicks. Navigating using the keyboard can generate both events.

Could an interface work without driving the user mad where selection 
raised a dialog ?

Raising a dialog would seem to be the natural result of a double-click 
or right-click - not a single left-click?

Anyhow, all that aside, if you really really wanted to do as you 
described, you would intercept the base mouse events.

As a single click must always precede any second click that might be 
interpreted as a double click you would have to wait for a period of 
time before deciding that a double click was not coming. This cannot be 
an exact measure - as the user may have changed the value on some OS's.

So, in your handler for EVT_LEFT_DOWN, record the mouse position and 
which item / sub item is selected. Set a flag saying 'single click in 
progress'.
In your handler for EVT_LEFT_UP, Set a timer ( 0.5 of a second ).

In your handler for EVT_LEFT_DCLICK, 'unset' the flag 'single click in 
progress'

In your handler for the Timer - check if flag saying 'single click in 
progress' is still set before raising dialog. (and resetting flags)

For reference, in a wxListCtrl if you handle EVT_LEFT_DOWN, EVT_LEFT_UP, 
and EVT_LEFT_DCLICK and NONE of these handlers call $event->Skip(1), the 
following events are raised in order:
(

EVT_LEFT_DOWN
EVT_LEFT_UP
EVT_LEFT_DCLICK
EVT_LEFT_UP

If you put an $event->Skip(1) in EVT_LEFT_DOWN you get
EVT_LEFT_DOWN
EVT_LIST_ITEM_FOCUSED
EVT_LIST_ITEM_SELECTED
EVT_LEFT_DCLICK
EVT_LEFT_UP

If you also put an $event->Skip(1) in EVT_LEFT_DCLICK you get
EVT_LEFT_DOWN
EVT_LIST_ITEM_FOCUSED
EVT_LIST_ITEM_SELECTED
EVT_LEFT_DCLICK
EVT_LIST_ITEM_ACTIVATED
EVT_LEFT_UP

Note that in these examples, the EVT_LIST_ITEM_xx handlers all have 
$event->Skip(1) in them.


Hope it helps

Regards

Mark


On 01/02/2013 20:24, steveco.1...@gmail.com wrote:
> Hi Guys,
>
> Actually, I'm quite interested in this discussion too.  I'm having
> difficulty distinguishing between EVT_LIST_ITEM_SELECTED and
> EVT_LIST_ITEM_ACTIVATED.
>
> If the user single-clicks (EVT_LIST_ITEM_SELECTED), then I want the user
to
> enter an event handler dialogue that presents options with defaults.
>
> If the user presses double-clicks (EVT_LIST_ITEM_ACTIVATED), then I want
the
> user to enter an event handler without a dialogue that takes the defaults
> automatically.
>
> What I get with single or double click, is that single click is always
> entered.
>
> I guess it's always triggered by the first click of the double click, but
it
> makes it hard to work out what the user intended.
>
> Any ideas, or do I have to find another way around this.
>
> Regards
>
> Steve
> -----Original Message-----
> From: Mark Dootson [mailto:mark.doot...@znix.com]
> Sent: 01 February 2013 01:16
> To: wxperl-users@perl.org
> Subject: Re: Getting information from EVT_LIST_ITEM_RIGHT_CLICK
>
> Hi,
>
> EVT_LIST_COL_RIGHT_CLICK - my wrong - sorry.
>
> I'll take a look at this tomorrow.
>
> On 01/02/2013 02:26, Dave Hayes wrote:
>> On 01/31/13 16:29, Mark Dootson wrote:
>>> Wrong EVT
>>>
>>> See EVT_LIST_COL_RIGHT_CLICK
>>
>> Er, ok. I tried that one and it doesn't send an event unless I click on
>> the column label at the top. I'm using 2.8.12 if that helps.
>>
>> I actually enabled both COL_RIGHT_CLICK and ITEM_RIGHT_CLICK to tell.
>

Reply via email to