smartGWT TileGrid::onKeyPress -- how to override Enter key, but keep default processing for other keys -
I am loading the file icon on the tile grid in a smartujt project. When the Enter key is pressed, I want to open the selected file for display.
When I override onKeyPress handler, it works, but tile grid navigational behavior lost the left / the right / up / down arrow keys.
My question is .., how to maintain the default processing behavior, while still entering the override key.
tileGrid.addKeyPressHandler (New KeyPressHandler () {@Override public void onKeyPress (KeyPressEvent event) {if {// Here's something special} else {to ** // Agenda (EventHandler.getKey ( ) Equal ("Enter").): .. ** is the default processing.}}}); Edit:
@las, here is the code, which imitates the problem.
package com.rv.gwtsample.client; Import com.google.gwt.core.client.EntryPoint; Import com.google.gwt.core.client.GWT; Import com.smartgwt.client.data.Record; Import com.smartgwt.client.widgets.events.KeyPressEvent; Import com.smartgwt.client.widgets.events.KeyPressHandler; Import com.smartgwt.client.widgets.tile.TileGrid; Import com.smartgwt.client.widgets.tile.TileRecord; / ** * @author rvnath * * / implements public square MyTileGrid EntryPoint {/ * (non-Javadoc) * @see com.google.gwt.core.client.EntryPoint # onModuleLoad () * / @Override public void onModuleLoad () {// TODO auto-generated method stub tilegred grid = new tilegrid (); Grid.setLeft (50); Grid.setTop (50); Grid.setWidth ("300"); Grid.setHeight ("200"); DetailViewerField Field = New DetailViewerField ("name"); Grid.setFields (area); grid.addKeyPressHandler (New KeyPressHandler () {@Override public void onKeyPress (KeyPressEvent event) {if (event.getKeyName () equal to ( "Enter")) GWT.log ( "Enter pressed") ;.}}); Record [] REC = new tilerecord [32]; For (int i = 0; i <32; ++ i) {rec [i] = new tile record (); } Grid. Settake (REC); Grid.draw (); }} If I disable the onkeypress handler, the arrow keys can navigate between the elements of the tile grid. If I enable, then change the whole tile grid panel instead of the selection changes. Instead of
Use
Kipreshandlr, KeyDownHandler tries, it works.
tileGrid.addKeyDownHandler (New KeyDownHandler () {@Override public void OnKeyDown (KeyDownEvent event) {if (EventHandler.getKey (). EqualsIgnoreCase ( "Enter")) {OpenModal (tileGrid.getSelectedRecord ());}}}); Tested with the latest 3.0 smartidge build.
Comments
Post a Comment