Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Canselable event not canseled.

31 views
Skip to first unread message

YuLo

unread,
Oct 5, 2012, 9:27:26 AM10/5/12
to
I have a xulrunner application(c++) with tree widget(custom tree view).
I'd like to change the behavior of tree widget when i press "right" arrow.
Not reasonable Mozilla's way to open container instead of go to the right neighbour cell(selection type = cell).

if i catch "keydown" event, "canselable"-attribute is equal to "true",
but PreventDefault() do not prevent default action(the container is opening).

Of course I can check in ToggleOpenState() function whether "right arrow" is pressed in first column and then cansel ToggleOpenState().
But may be there is a simpler way? And i'd like to understand more Mozilla's internals.

Neil

unread,
Oct 6, 2012, 2:38:17 PM10/6/12
to
YuLo wrote:

>I have a xulrunner application(c++) with tree widget(custom tree view).
>if i catch "keydown" event, "canselable"-attribute is equal to "true",
>but PreventDefault() do not prevent default action(the container is opening).
>
>
Unfortunately the XBL [1] that handles the key events for tree widgets
does not check for the PreventDefault action (indeed, it doesn't even
run in the system event group). So the only way to stop it is to capture
the event before it reaches the tree and stop the event's propagation.

[1]
http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/tree.xml#826

--
Warning: May contain traces of nuts.

YuLo

unread,
Oct 7, 2012, 1:15:01 PM10/7/12
to
Nail wrote:

> Unfortunately the XBL [1] that handles the key events for tree widgets
>
> does not check for the PreventDefault action (indeed, it doesn't even
>
> run in the system event group). So the only way to stop it is to capture
>
> the event before it reaches the tree and stop the event's propagation.
>
>

as far as i understand i capture the event
DomEventTarget->AddEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE);

and stop event propagation
keyEvent->StopPropagation();

but no result!

Neil

unread,
Oct 7, 2012, 5:21:30 PM10/7/12
to
YuLo wrote:

>Nail wrote:
>
>
[How did you manage to spell my name incorrectly?]
Sorry, I should have pointed out that the tree widget looks for the
keypress event, so that's the one you have to capture, and of course
capturing on the element itself doesn't help because stopPropagation
only stops dispatch to subsequent elements.

YuLo

unread,
Oct 8, 2012, 11:56:49 AM10/8/12
to
понедельник, 8 октября 2012 г., 1:21:31 UTC+4 пользователь Neil написал:
Sorry, Neil, and thank you very much for your help.
I accidentlaly deleted your name, then wrote it by hand with error.
Hope you'll excuse me.
0 new messages