Recent

Author Topic: [LAMW] jsRecyclerView (OnClickItem)  (Read 3238 times)

Odanka

  • New Member
  • *
  • Posts: 40
[LAMW] jsRecyclerView (OnClickItem)
« on: July 10, 2021, 02:53:42 pm »
I have multiple form in the Apps.
Some code:
Code: [Select]
procedure TApps_Main.jsRecyclerView1ItemClick(Sender: TObject;
  itemPosition: integer);
begin
  jsRecyclerView1.Refresh(itemPosition);
  case itemPosition of
    0:
    begin
      if AM_Kendaraan = nil then
        gApp.CreateForm(TAM_Kendaraan, AM_Kendaraan);
      AM_Kendaraan.Init(gApp);
      AM_Kendaraan.Show;
    end;
  end;
end;
The above code will not work and the application immediately close (stopped)

And this code work properly
Code: [Select]
procedure TApps_Main.Apps_MainClickOptionMenuItem(Sender: TObject;
  jObjMenuItem: jObject; itemID: integer; itemCaption: string;
  Checked: boolean);
begin
  case itemID of
    // Kendaraan
    1200:
    begin
      if AM_Kendaraan = nil then
        gApp.CreateForm(TAM_Kendaraan, AM_Kendaraan);
      AM_Kendaraan.Init(gApp);
      AM_Kendaraan.Show;
    end;
  end;
end;   

Anyone please...
Thank you..

jmpessoa

  • Hero Member
  • *****
  • Posts: 1913
Re: [LAMW] jsRecyclerView (OnClickItem)
« Reply #1 on: July 10, 2021, 04:00:45 pm »
Hi, Odanka!

1) When did you update LAMW (how many days ago...)?

2) What your Android System  (7, 8, 9, ....) ?
« Last Edit: July 10, 2021, 08:25:52 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Mongkey

  • Full Member
  • ***
  • Posts: 160
Re: [LAMW] jsRecyclerView (OnClickItem)
« Reply #2 on: July 10, 2021, 05:02:52 pm »

Odanka

  • New Member
  • *
  • Posts: 40
Re: [LAMW] jsRecyclerView (OnClickItem)
« Reply #3 on: July 11, 2021, 03:25:21 am »
Hi, Odanka!

1) When did you update LAMW (how many days ago...)?

2) What your Android System  (7, 8, 9, ....) ?

I have download the latest version of LAMW on 05/July/2021 and installed (last 6 days ago).
I Use android system 10 (physical device) 
« Last Edit: July 11, 2021, 03:27:00 am by Odanka »

jmpessoa

  • Hero Member
  • *****
  • Posts: 1913
Re: [LAMW] jsRecyclerView (OnClickItem)
« Reply #4 on: July 11, 2021, 04:03:40 am »
Quote
I Use android system 10 (physical device) ....

Yes,  there is some change related to security ... and now we are recommending

coding all "gApp.CreateForm"  handling  "OnActivityCreate" event and

then "Init/Show"  the forms later... when your logic requires.....

Just 6 days ago we made a LAMW update to try keep up with these Android changes....

And yes,  handling ClickOptionMenuItem  "work properly" given the proximity of these two events in the LAMW architecture ....

PS.
Keep your LAMW updated! (we are working hard....)
« Last Edit: July 11, 2021, 04:06:09 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018