Setfocus not working on LANSA Mobile
Setfocus not working on LANSA Mobile
I have an application that moves focus from one field to the other and it works fine in the browser.
When I test it in LANSA mobile, it focus is lost and I can't see where it is.
The app has a keypress event on the pull sheet. When they type 8 or more characters (or scan with a bluetooth scanner), I run a server routine to get information, and move focus to the UPC.
Keypress event on UPC looks for 12 or more characters and does another server routine. Once it's complete I do a #upc.setfocus, but it never shows on lansa mobile.
Not sure if it's related, but I do a fadein on a splash screen (prim_ppnl reusable part), and it's not displayed.
When I test it in LANSA mobile, it focus is lost and I can't see where it is.
The app has a keypress event on the pull sheet. When they type 8 or more characters (or scan with a bluetooth scanner), I run a server routine to get information, and move focus to the UPC.
Keypress event on UPC looks for 12 or more characters and does another server routine. Once it's complete I do a #upc.setfocus, but it never shows on lansa mobile.
Not sure if it's related, but I do a fadein on a splash screen (prim_ppnl reusable part), and it's not displayed.
Last edited by atostaine on Thu Mar 15, 2018 10:56 am, edited 1 time in total.
Art Tostaine
Re: Setfocus not working on LANSA Mobile
When you say it works on the browser, did you mean on your PC, or on iOS Safari on your phone?
-
- Posts: 51
- Joined: Mon Feb 01, 2016 10:08 am
- Location: Australia
Re: Setfocus not working on LANSA Mobile
Hi Art,
Is this on an Android device?
If so, I have encountered the same issue. From what I can see, in VL Web neither the Changed event nor the Keypress event are fired while the IME is offering autocomplete suggestions.
My issues logged with LANSA support as a low priority correction.
Is this on an Android device?
If so, I have encountered the same issue. From what I can see, in VL Web neither the Changed event nor the Keypress event are fired while the IME is offering autocomplete suggestions.
My issues logged with LANSA support as a low priority correction.
Re: Setfocus not working on LANSA Mobile
I'm on iOs. The keypress event is firing for me, it's just not setting focus properly after that event is complete.
Art Tostaine
-
- Posts: 25
- Joined: Thu May 19, 2016 11:34 am
Re: Setfocus not working on LANSA Mobile
Atostaine,
Have you paired the keypress event with a timer?
When using the keypress event to trigger an action, especially an action to get data from the server, the data events and the keypress event can cancel each other out due to the single threaded nature of javascript. Hence you need separate the event happening at the same time.
So we just use a similar technique to the filtering data example in the samples section of the IDE.
First, define a timer like this
now when you listen for the keypress, start and stop the
and now carry out your action when the timer ticks, just be sure to stop the stop timer first
Hope this helps.
Have you paired the keypress event with a timer?
When using the keypress event to trigger an action, especially an action to get data from the server, the data events and the keypress event can cancel each other out due to the single threaded nature of javascript. Hence you need separate the event happening at the same time.
So we just use a similar technique to the filtering data example in the samples section of the IDE.
First, define a timer like this
Code: Select all
Define_Com Class(#PRIM_TIMR) Name(#KeyPressTimer) Startup(Manual) Interval(250)
Code: Select all
Evtroutine Handling(#Edit.KeyPress)
#KeyPressTimer.Stop
#KeyPressTimer.Start
Endroutine
Code: Select all
Evtroutine Handling(#KeyPressTimer.Tick)
#KeyPressTimer.Stop
<<Now call you data method>>
Endroutine
Re: Setfocus not working on LANSA Mobile
The timer technique didn't fix my problem. What's interesting is if I click on the UPC field, the keyboard pops up and I can see that the field has focus.
When typing in a upc, I don't move focus at all. I want the cursor to stay in the upc field. But I have to touch the edit box to bring up the keyboard each time.
Maybe focus doesn't work on a device the same way? This code demonstrates my problem. If you type 99 in either field focus is moved to the other field.
When run on a PC, it works fine. When on LANSA mobile or Chrome on iOS Browser, you can't see focus.
When typing in a upc, I don't move focus at all. I want the cursor to stay in the upc field. But I have to touch the edit box to bring up the keyboard each time.
Maybe focus doesn't work on a device the same way? This code demonstrates my problem. If you type 99 in either field focus is moved to the other field.
When run on a PC, it works fine. When on LANSA mobile or Chrome on iOS Browser, you can't see focus.
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Height(300) Width(400)
Define_Com Class(#STD_DESCL.Visual) Name(#STD_DESCL) Componentversion(1) Displayposition(1) Height(21) Left(7) Marginleft(50) Parent(#COM_OWNER) Tabposition(1) Top(15) Usepicklist(False) Width(250)
Define_Com Class(#STD_DESCS.Visual) Name(#STD_DESCS) Componentversion(1) Displayposition(2) Height(21) Left(7) Marginleft(50) Parent(#COM_OWNER) Tabposition(2) Top(37) Usepicklist(False) Width(250)
EVTROUTINE HANDLING(#std_Descl.Changed)
if (#std_Descl = '99')
#std_Descs.setFocus
endIf
ENDROUTINE
EVTROUTINE HANDLING(#std_Descs.Changed)
if (#std_Descs = '99')
#std_descl.setFocus
endIf
ENDROUTINE
End_Com
Art Tostaine
-
- Posts: 25
- Joined: Thu May 19, 2016 11:34 am
Re: Setfocus not working on LANSA Mobile
Can you confirm what version of iOS this is being tested on?
Thanks
Thanks
Re: Setfocus not working on LANSA Mobile
*edit* using LANSA mobile or Chrome. I’ll test with safari.
Art Tostaine
-
- Posts: 25
- Joined: Thu May 19, 2016 11:34 am
Re: Setfocus not working on LANSA Mobile
atostaine,
I just tried your code, and when I type 99 into either field the focus moves to the other field and is visible a having focus. I have tested,
Windows (10, build 16299.309)
Chome (Stable and Dev Channel)
Firefox (Stable and Developer Preview)
Edge
Android (8.1)
Chrome
iOS (11.2.6)
Safari
LANSA Mobile
Visual LANSA was V14 SP1 EPC141070
I just tried your code, and when I type 99 into either field the focus moves to the other field and is visible a having focus. I have tested,
Windows (10, build 16299.309)
Chome (Stable and Dev Channel)
Firefox (Stable and Developer Preview)
Edge
Android (8.1)
Chrome
iOS (11.2.6)
Safari
LANSA Mobile
Visual LANSA was V14 SP1 EPC141070
Re: Setfocus not working on LANSA Mobile
Here is what my screen looks like after typing 99 in safari.
I am on 14070 also.
I am on 14070 also.
Art Tostaine
Re: Setfocus not working on LANSA Mobile
I'll submit an incident to support here in USA as well.
Art Tostaine
-
- Posts: 25
- Joined: Thu May 19, 2016 11:34 am
Re: Setfocus not working on LANSA Mobile
And I get this.Also the keyboard stays visible
Re: Setfocus not working on LANSA Mobile
Thank you for your help. I submitted my incident.
It doesn't work on my Ipad either
It doesn't work on my Ipad either

Art Tostaine