Standalone riddle
Paul Dupuis
paul at researchware.com
Fri Jan 13 19:40:27 EST 2023
Fully qualified object references are your friend.
Have you tried referring to the field as:
put pText into field "searchTerm" of cd 1 of stack "stackName" -- of
instead of the card number, use name or ID
On 1/13/2023 4:42 PM, J. Landman Gay via use-livecode wrote:
> I have a 2-card stack, very simple. The first card has a plain text
> list field and an editable search field. The user types in a string
> and the resulting match is displayed on card 2 with definitions. The
> stack requires no inclusions and scripts are extremely basic. I use a
> native Android field for the search term, and since mobile controls
> will be removed when the card closes, I place the search term into a
> hidden LC field for later reference.
>
> I build for Android using LC 10 dp 4, signed for "development only".
> If I cable the phone to the Mac and do a Test build, the apk runs
> perfectly. If I build an independent standalone and install the apk
> from Google Drive, it runs fine except when putting the search term
> into the LC field, where it claims there is no such object. It is most
> certainly there on the card.
>
> I can fix this instance by using "field x of me" but then I get the
> same error in an unrelated line in a different handler. If I fix that
> one, it moves again. The riddle is why does it happen in a standalone
> apk and not in a cabled test run?
>
> The script snippet from cd 1:
>
> on doSearch pText -- pText extracted from native field
> put word 1 to -1 of pText into pText -- strip trailing spaces
> put pText into fld "searchTerm" -- for reference; ERROR: "no such
> object"
> ... <retrieve definition, populate a browser widget on cd 2>
> go cd 2
>
> BTW, if I leave the test apk on the phone it continues to work
> correctly after removing the cable. The odd behavior happens
> consistently on a Pixel 7 phone, an old Huawei tablet and a newish
> Samsung tablet.
>
> If I use Nearby Share to move the working apk from a previously cabled
> build to another device, it also works okay. So something is different
> when building an independent standalone vs. building a test app.
>
More information about the use-livecode
mailing list