Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to prevent Ctrl+A chrome handling for Layout component

    Hi, im using smartgwt 2.5. We are using shortcuts on Layout component. In FF to prevent Ctrl+a to select everything we use:
    Code:
    flowChart.addKeyPressHandler(new KeyPressHandler() {
    
    			@Override
    			public void onKeyPress(KeyPressEvent event) {
    				if (event.getKeyName().equals("A") && event.isCtrlKeyDown() && flowChart.canSelectAll()) {
    					...
    					event.cancel(); // don't propagate to browser
    				}
    			}
    		});
    Unfortunately this does not work in Chrome. Here everything is selected even before the event is handled so im really not sure how to prevent the browser handling. But in TextItem there ctrl+a works fine so there should be a way.
    Can you help me with this?

    #2
    We can't tell from this what component you're trying this on and hence what default key handling logic your code could be interacting with. If just this code is required to reproduce a problem, can you add it to a sample to produce a test case we can run?

    Comment


      #3
      I've actually mentioned it. Its my own subclass of com.smartgwt.client.widgets.layout.Layout.

      Comment


        #4
        Are you able to give me some hints?? Im waiting for your reply couple days now.

        Comment


          #5
          Hi Mismun,
          You should be able to resolve this issue by intercepting the keyDown event rather than the keyPress event and cancelling that event.
          This should work on all browsers (so no need for both a keyDown and keyPress event handler).

          If this doesn't behave as expected let us know and we'll take another look.

          Regards
          Isomorphic Software

          Comment

          Working...
          X