Re: [Echo-list] Getting lost focus event in text field
Brought to you by:
tliebeck
From: Georg S. <geo...@we...> - 2004-03-01 16:24:51
|
to fulfill the requirements you can do the following: 1. create a new component based on nextapp.echo.TextField. 2. in your TextFieldUI change the SERVICE_TEXT_FIELD_SCRIPT to a modified one: [code] function E_textFieldKeyPress(event, E_id, E_value) { var E_code; if (event.keyCode) { E_code = event.keyCode; } else { E_code = event.which; } if (E_code == 13) { E_setParameter(E_id, E_value); E_setAction(E_id, "enter"); } if(E_code == 9) { E_setParameter(E_id, E_value); E_setAction(E_id, "tab"); } } [/code] This script detects the TAB (9) key and notifies the server with E_setAction(...) If you want to distinct whether "enter" or "tab" was pressed modify the clientAction-Method of your TextFieldUI to something like this: [code] public void clientAction(String command) { if (renderedActive) { if("tab".compareTo(command) == 0) doTabWork(); else { TextField textField = (TextField) getComponent(); textField.fireActionEvent(); } } } [/code] best regards, Georg Am Mon, 2004-03-01 um 14.43 schrieb Francisco Figueiredo Jr.: > Bra...@ca... wrote: > > > > Echo does not generate an event for lost focus. Remeber, Echo is a server > > side framework that tries to minmise the number of interactions between the > > client and the server. > > > > > You could create your own TexField and TextFieldUI peer to render a > > TextField that raised and event on lost focus however it would run rather > > slow for the user, what with alll those server interactions. > > > > Thanks Brad! > Yes, I know this would be rather slow for the user, but it is a user > requirement. When she hits "tab", and so this changes focus away from > text field, the screen must be updated. The only way I thought I could > do that was when the text field lost focus. > > Thanks in advance. > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Echo-list mailing list > Ech...@li... > https://lists.sourceforge.net/lists/listinfo/echo-list |