Recent

Author Topic: LAMW: jListView set to specific item?  (Read 2751 times)

c4p

  • Full Member
  • ***
  • Posts: 157
LAMW: jListView set to specific item?
« on: August 09, 2017, 02:46:53 pm »
Is there a way to set the jListView to a specific item that is viewable, you can set it to an index but does not reflect visibly. The jGridView component has .setSelection which works fine, but nothing for jListView? is their a workaround for this?

Really appreciate the work done on LAMW btw :)
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle v8.5

c4p

  • Full Member
  • ***
  • Posts: 157
Re: LAMW: jListView set to specific item?
« Reply #1 on: August 12, 2017, 05:48:32 pm »
 :(
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle v8.5

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW: jListView set to specific item?
« Reply #2 on: August 24, 2017, 03:06:35 am »

Hello, c4p!

Please,  update LAMW from github and try:

 
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. begin
  3.    jListView1.HighLightSelectedItemColor:= colbrRed;  //any color <> default!
  4.    jListView1.SetItemChecked(5, True);  //some  valid index ....
  5.    ShowMessage(IntToStr(jListView1.GetCheckedItemPosition()));
  6. end;
  7.  

Note: I will try some improvement to scroll to selected index...

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

c4p

  • Full Member
  • ***
  • Posts: 157
Re: LAMW: jListView set to specific item?
« Reply #3 on: August 25, 2017, 08:18:45 am »
Excellent, will try it later.
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle v8.5

c4p

  • Full Member
  • ***
  • Posts: 157
Re: LAMW: jListView set to specific item?
« Reply #4 on: August 26, 2017, 05:25:41 pm »

Hello, c4p!

Please,  update LAMW from github and try:

 
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. begin
  3.    jListView1.HighLightSelectedItemColor:= colbrRed;  //any color <> default!
  4.    jListView1.SetItemChecked(5, True);  //some  valid index ....
  5.    ShowMessage(IntToStr(jListView1.GetCheckedItemPosition()));
  6. end;
  7.  

Note: I will try some improvement to scroll to selected index...

Thank you!

This works, if I could get it to autoscroll to the position, that would be great.
« Last Edit: August 26, 2017, 10:49:21 pm by c4p »
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle v8.5

 

TinyPortal © 2005-2018