* * *

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

c4p

  • Jr. Member
  • **
  • Posts: 68
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 :)

c4p

  • Jr. Member
  • **
  • Posts: 68
Re: LAMW: jListView set to specific item?
« Reply #1 on: August 12, 2017, 05:48:32 pm »
 :(

jmpessoa

  • Hero Member
  • *****
  • Posts: 954
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: 68
Re: LAMW: jListView set to specific item?
« Reply #3 on: August 25, 2017, 08:18:45 am »
Excellent, will try it later.

c4p

  • Jr. Member
  • **
  • Posts: 68
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 »

 

Recent

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