1. focus problem
- Posted by dcole Jun 06, 2011
- 1343 views
This is my EditText layout in a window.
ET1 | ET2 | ET3 |
---|
ET4 | ET5 | ET6 |
---|
ET7 | ET8 | ET9 |
---|
What I want to do:
1. open window with ET1 in focus. (I know how to do that).
2. onKeyDown of ET1 I want focus to go to ET5 (not ET2).
3. onKeyDown of ET5 I want focus to go to ET9.
4. onKeyDown of ET9 I want focus to go back to ET1 and so on.
How can I do that?
I'm using the following code but it doesn't work.
procedure ET_onKeyDown (integer self, integer event, sequence params)--params is ( atom scanCode, atom shift ) if params[1] = 13 then if self=ET1 then setFocus(ET5) elsif self=ET5 then setFocus(ET9) elsif self=ET9 then setFocus(ET1) end if end procedure setHandler({ET1,ET5,ET9} w32HKeyDown, routine_id("ETonKeyDown")) procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setFocus(ET1) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate"))
Don Cole
2. Re: focus problem
- Posted by ghaberek (admin) Jun 06, 2011
- 1302 views
Are you using the latest version of Win32Lib?
https://sourceforge.net/projects/win32libex/files/v_0_70_20/
-Greg
3. Re: focus problem
- Posted by DerekParnell (admin) Jun 06, 2011
- 1280 views
What I want to do:
1. open window with ET1 in focus. (I know how to do that).
2. onKeyDown of ET1 I want focus to go to ET5 (not ET2).
3. onKeyDown of ET5 I want focus to go to ET9.
4. onKeyDown of ET9 I want focus to go back to ET1 and so on.
How can I do that?
According to the documentation on EditText controls, you need this ...
procedure IgnoreReturn(integer self, integer event, sequence parms) if parms[1] = VK_RETURN and parms[2] = 0 then returnValue(-1) end if end procedure setHandler(myEditField, w32HKeyPress, routine_id("IgnoreReturn")
4. Re: focus problem
- Posted by dcole Jun 07, 2011
- 1211 views
According to the documentation on EditText controls, you need this ...
procedure IgnoreReturn(integer self, integer event, sequence parms) if parms[1] = VK_RETURN and parms[2] = 0 then returnValue(-1) end if end procedure setHandler(myEditField, w32HKeyPress, routine_id("IgnoreReturn")
Thank you Derek,
This does deflect the focus from the next EditText in the focus order.
But how do I focus the one I want?
Don Cole