* * *

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

c4p

  • Jr. Member
  • **
  • Posts: 97
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 1.7 on W10 with LAMW rev.691

c4p

  • Jr. Member
  • **
  • Posts: 97
Re: LAMW: jListView set to specific item?
« Reply #1 on: August 12, 2017, 05:48:32 pm »
 :(
Lazarus 1.7 on W10 with LAMW rev.691

jmpessoa

  • Hero Member
  • *****
  • Posts: 1143
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

  • Jr. Member
  • **
  • Posts: 97
Re: LAMW: jListView set to specific item?
« Reply #3 on: August 25, 2017, 08:18:45 am »
Excellent, will try it later.
Lazarus 1.7 on W10 with LAMW rev.691

c4p

  • Jr. Member
  • **
  • Posts: 97
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 1.7 on W10 with LAMW rev.691

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus