Page 1 of 1

Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 10:34 am
by atostaine
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.
Image-1 (2).jpg
Image-1 (2).jpg (43.08 KiB) Viewed 4351 times
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.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 10:41 am
by tsupartono
When you say it works on the browser, did you mean on your PC, or on iOS Safari on your phone?

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 10:57 am
by davidbalansa
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.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 10:58 am
by atostaine
On my PC. Same problem on the iOs browser.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 11:20 am
by atostaine
I'm on iOs. The keypress event is firing for me, it's just not setting focus properly after that event is complete.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 11:44 am
by GregSippel
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

Code: Select all

Define_Com Class(#PRIM_TIMR) Name(#KeyPressTimer) Startup(Manual) Interval(250)
now when you listen for the keypress, start and stop the

Code: Select all

Evtroutine Handling(#Edit.KeyPress)

#KeyPressTimer.Stop
#KeyPressTimer.Start

Endroutine
and now carry out your action when the timer ticks, just be sure to stop the stop timer first

Code: Select all

Evtroutine Handling(#KeyPressTimer.Tick)

#KeyPressTimer.Stop

<<Now call you data method>>

Endroutine
Hope this helps.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 12:08 pm
by atostaine
Thank you. I am going to try it now.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 12:36 pm
by atostaine
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.

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

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 1:33 pm
by GregSippel
Can you confirm what version of iOS this is being tested on?

Thanks

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 1:43 pm
by atostaine
*edit* using LANSA mobile or Chrome. I’ll test with safari.
6E55682D-AC66-45EF-9B30-625C8CC5AD1B.jpeg
6E55682D-AC66-45EF-9B30-625C8CC5AD1B.jpeg (39.92 KiB) Viewed 4321 times

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 1:51 pm
by GregSippel
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

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 1:59 pm
by atostaine
Here is what my screen looks like after typing 99 in safari.

I am on 14070 also.
IMG_1496.PNG
IMG_1496.PNG (10.37 KiB) Viewed 4310 times

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 2:09 pm
by atostaine
I'll submit an incident to support here in USA as well.

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 2:12 pm
by GregSippel
And I get this.Also the keyboard stays visible
focus1.png
focus1.png (4.98 KiB) Viewed 4308 times

Re: Setfocus not working on LANSA Mobile

Posted: Thu Mar 15, 2018 2:18 pm
by atostaine
Thank you for your help. I submitted my incident.

It doesn't work on my Ipad either :-)