Announcement

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

    KeyDownEvent on SGWT 3.0

    Hi Isomorphic,

    I have a problem with key down events.
    It seems you have changed the key event handling in SGWT 3.0.

    I am using the SmartGWT LGPL 3.0 nightly build (12/05/2011) as I couldn't find the released 3.0 on the SmartGWT google code download page.
    Tested on browsers IE 9 and FF 3.6.

    We have added a key down handler to a TabSet which checks for ctrl + <some other key> combinations. This used to work perferctly well with SGWT 2.5. The code which should be executed on this event isn't triggered anymore if the current focus is on some FormItem within the currently selected Tab. If the focus is on a Canvas (e.g. Button) it works.

    Example:
    Code:
    tabSet.addKeyDownHandler(new KeyDownHandler() {
    public void onKeyDown(final KeyDownEvent event) {
    if(Boolean.TRUE.equals(EventHandler.ctrlKeyDown())){				
    if ("Arrow_Up".equalsIgnoreCase(EventHandler.getKey())) {		
    	// do sth.
    }
    Any suggestion how to get this working again.

    Best regards,
    Manuel

    #2
    First, make sure you have run a GWT compile and cleared cache. Then, please show a complete minimal test case with instructions on where to click in order to put focus in the right spot to reproduce a problem.

    Comment


      #3
      The behaviour persists.
      Some more info:
      - It seems the behaviour only occurs in combination with Arrow keys.
      - It is not related to the TabSet. Tested also with Layout (see sample below).
      - Tested on different FormItems: TextItem and CheckboxItem (see sample below)

      Here is the sample:

      Code:
      private void testCtrlKey(){
      	VLayout vLayout = new VLayout();
      	vLayout.setWidth(400);   
      	vLayout.setHeight(200);
      	vLayout.setMembersMargin(15);   
      
      	DynamicForm form = new DynamicForm();
              form.setNumCols(1);
              TextItem textItem = new TextItem();
              textItem.setTitle("Ctrl + Arrow_Up doesn't work");
              textItem.setTitleOrientation(TitleOrientation.TOP);
              CheckboxItem cbItem = new CheckboxItem();
              cbItem.setTitle("Ctrl + Arrow_Up doesn't work");
              cbItem.setTitleOrientation(TitleOrientation.TOP);
      	form.setFields(textItem, cbItem);  
      	           
              vLayout.addKeyDownHandler(new KeyDownHandler() {
      	    public void onKeyDown(KeyDownEvent event) {
      		if(Boolean.TRUE.equals(EventHandler.ctrlKeyDown())) {
      		   if ("Arrow_Up".equalsIgnoreCase(EventHandler.getKey())) {
      			SC.say("Pressed Ctrl and Arrow up");
      			event.cancel();
      		   }
      	        }
      	}});
              vLayout.addMember(form);
              IButton button = new IButton("Ctrl + Arrow_Up works");
              button.setSize("300", "20");
              vLayout.addMember(button);
              vLayout.draw();  
              textItem.focusInItem();
      }

      Comment


        #4
        Forgot the instructions:

        - Initial focus is set to text item.
        - Press CTRL + Arrow Up.
        >> no message pops up

        - Press tab to focus check box
        - Press CTRL + Arrow Up.
        >> no message pops up

        - Press tab to focus button
        - Press CTRL + Arrow Up.
        >> message is shown

        Comment


          #5
          Hi Isomorphic,

          are you able to reproduce the behaviour with the test case I have posted?

          Best regards,
          Manuel

          Comment


            #6
            It's queued to be looked at. For prioritized service, purchase a support contract.

            Comment


              #7
              I have retested it with an SGWT 3.1 nightly build.
              It seems to be fixed. Great!

              Best regards,
              Manuel

              Comment

              Working...
              X