Setfocus not working on LANSA Mobile

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 10:34 am

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 4625 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.
Last edited by atostaine on Thu Mar 15, 2018 10:56 am, edited 1 time in total.
Art Tostaine

tsupartono

Re: Setfocus not working on LANSA Mobile

Post by tsupartono » Thu Mar 15, 2018 10:41 am

When you say it works on the browser, did you mean on your PC, or on iOS Safari on your phone?

davidbalansa
Posts: 51
Joined: Mon Feb 01, 2016 10:08 am
Location: Australia

Re: Setfocus not working on LANSA Mobile

Post by davidbalansa » Thu Mar 15, 2018 10:57 am

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.

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 10:58 am

On my PC. Same problem on the iOs browser.
Art Tostaine

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 11:20 am

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

GregSippel
Posts: 25
Joined: Thu May 19, 2016 11:34 am

Re: Setfocus not working on LANSA Mobile

Post by GregSippel » Thu Mar 15, 2018 11:44 am

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.

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 12:08 pm

Thank you. I am going to try it now.
Art Tostaine

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 12:36 pm

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
Art Tostaine

GregSippel
Posts: 25
Joined: Thu May 19, 2016 11:34 am

Re: Setfocus not working on LANSA Mobile

Post by GregSippel » Thu Mar 15, 2018 1:33 pm

Can you confirm what version of iOS this is being tested on?

Thanks

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 1:43 pm

*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 4595 times
Art Tostaine

GregSippel
Posts: 25
Joined: Thu May 19, 2016 11:34 am

Re: Setfocus not working on LANSA Mobile

Post by GregSippel » Thu Mar 15, 2018 1:51 pm

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

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 1:59 pm

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 4584 times
Art Tostaine

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 2:09 pm

I'll submit an incident to support here in USA as well.
Art Tostaine

GregSippel
Posts: 25
Joined: Thu May 19, 2016 11:34 am

Re: Setfocus not working on LANSA Mobile

Post by GregSippel » Thu Mar 15, 2018 2:12 pm

And I get this.Also the keyboard stays visible
focus1.png
focus1.png (4.98 KiB) Viewed 4582 times

atostaine
Posts: 457
Joined: Wed Jan 20, 2016 7:38 am

Re: Setfocus not working on LANSA Mobile

Post by atostaine » Thu Mar 15, 2018 2:18 pm

Thank you for your help. I submitted my incident.

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

Post Reply