Uniface User Forum

 View Only
  • 1.  Setting focus on android app.

    PARTNER
    Posted 01-05-2023 10:38
    I am trying to use document.getelementbyid(elementid).focus to set the focus to a particular field of a particular occurrence. 
    I am building the elementid from "ufld:my(new)field.<$entname>.<$modelname>:%%$instancename%%%.%%$curocc("<$entname>")%%%"
    This seems to be working okay on the web page version in chrome, and on the android studio emulation, but on my actual android phone, it gets the field correct, but the occurrence is wrong. 
    Does anyone have any idea how I can identify the correct number to put at the end of the element id? 
    Regards, 
    Iain

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------


  • 2.  RE: Setting focus on android app.

    ROCKETEER
    Posted 01-06-2023 07:28
    Hi Iain,

    The number is a sequence number to add uniqueness, rather than an occurrence number and it is possible for the number to be reused and be out of sequence when occurrences are deleted or changed data is received from the server.

    You should be able to use the  focus() method on the field objects focus() (rocketsoftware.com)

    e.g.
    uniface.getInstance().getEntity("myEntity.Model").getOccurrence(3).getField("myField").focus();

    Kind regards,
    Mike

    ------------------------------
    Michael Taylor
    Rocket Internal - All Brands
    ------------------------------