PDA

View Full Version : How to disbale control (ctrl) key on hyperlink?



livinglegends
13 Jul 2010, 11:13 PM
Hi,

I want to disable control key on hyperlink. I mean, when user keep pressing ctrl key and click on hyperlink, that hyperlink should not work means user can click on hyperlink without pressing ctrl key.

How, to achieve this think?

Thanks in Advance
Livinglegends

livinglegends
16 Jul 2010, 1:33 AM
no body?

Animal
16 Jul 2010, 2:09 AM
Add a document click listener using delegate: 'a'

Cancel the event if the CTRL button is pressed (The EventObject tells you this)

livinglegends
16 Jul 2010, 5:00 AM
Add a document click listener using delegate: 'a'

Cancel the event if the CTRL button is pressed (The EventObject tells you this)


Can you give some more details to implement it or some code hint regarding this?

Animal
16 Jul 2010, 5:19 AM
Step by step. Add a document click listener. Do that and show code.

fay
16 Jul 2010, 5:23 AM
Take a look at Ext.select and then search the forums for how it has been used with the 'click' event.

Animal
16 Jul 2010, 5:28 AM
I would say delegation would be better than that for a couple of reasons.


A CompositeElement still performs the called method on each and every member, so that would be maybe dozens, but perhaps more click listeners.

If you add more <a> elements after you first collect them, they won't be handled (unless you do it again... only adding newly added <a> elements)

fay
16 Jul 2010, 5:33 AM
^^ ahh, that never occurred to me. Ta, nice to learn something new!

Animal
16 Jul 2010, 6:35 AM
So Ledge, old chap. Have you god a document click listener added?