Front page | perl.wxperl.users |
Postings from February 2013
Re: Getting information from EVT_LIST_ITEM_RIGHT_CLICK
Thread Previous
|
Thread Next
From:
Mark Dootson
Date:
February 5, 2013 05:36
Subject:
Re: Getting information from EVT_LIST_ITEM_RIGHT_CLICK
Message ID:
51109A38.1000901@znix.com
Hmmm,
Regarding wxListCtrl event occurrence and ordering, upon investigation I
find differences between wxMSW and wxGTK. These probably won't affect
you at all, but it does mean the event order in a previous post was not
necessarily correct.
On wxMSW, if you click on a single item that is already selected,
EVT_LIST_ITEM_FOCUSED EVT_LIST_ITEM_SELECTED are not raised ( as you
might expect as the focus and selection have not changed )
On wxGTK, however, you get
EVT_LIST_ITEM_DESELECTED
EVT_LIST_ITEM_FOCUSED
EVT_LIST_ITEM_SELECTED
all for the same item. So on wxGTK, clicking on an already selected
item, when it is the only selected item, produces the above three
events whilst on wxMSW none are raised.
I've never noticed this before, as there's no reason you would - the
event handlers would just run somewhat unnecessarily. But it does make
the original note below untrue.
Perhaps more notably, if you are in multi select mode, the order of EVTs
and EVTs raised are different on different platforms.
So, if on wxMSW item 0 is selected and I select item 1 using shift+
left-click, I get
EVT_LIST_ITEM_SELECTED
EVT_LIST_ITEM_FOCUSED
for item 1.
However, on wxGTK I get the events in reverse order
EVT_LIST_ITEM_FOCUSED
EVT_LIST_ITEM_SELECTED
Again, it should not affect most code - but you may have made
assumptions about EVT_LIST_ITEM_FOCUSED and EVT_LIST_ITEM_SELECTED being
received in a certain order - which would be wrong. The basic reason for
these differences is that on wxMSW, wxListCtrl is a wrapper for a native
MS Windows control. On wxGTK it is a generic wxWidgets implementation.
Regards
Mark
On 05/02/2013 04:31, Mark Dootson wrote:
> 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.1959@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.dootson@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.
>>
Thread Previous
|
Thread Next