Recent

Author Topic: LAMW and Custom Drawing jListView Items  (Read 538 times)

Robert Gilland

  • Full Member
  • ***
  • Posts: 146
LAMW and Custom Drawing jListView Items
« on: April 09, 2019, 03:45:26 pm »
I have been looking without any success for something that will allow me to custom draw a listview item.

Or maybe another Component I could use to do this?

An event like:

jListView.OnCustomDrawListViewItem( index : Integer; canvas :TCanvas  ).

Then I could place all my elements where I need them to be like:

Canvas.DrawBitMap( 0,0, 10, 10, MyRetrievedBitMap )

Canvas.DrawText( 10,0,0,0, "Some Text')


etc

howardpc

  • Hero Member
  • *****
  • Posts: 3210
Re: LAMW and Custom Drawing jListView Items
« Reply #1 on: April 09, 2019, 04:11:39 pm »
I'm not familiar with jListView.
However, the bog-standard LCL TListView offers three 'custom' events, you can choose which one might meet your needs (they have differing parameter signatures):
  • OnCustomDraw
  • OnCustomDrawItem
  • OnCustomDrawSubItem

Robert Gilland

  • Full Member
  • ***
  • Posts: 146
Re: LAMW and Custom Drawing jListView Items
« Reply #2 on: April 09, 2019, 11:53:50 pm »
jListView is part of the LAMW Library, built for mobile Apps on Android, which have to deal with rotating screens.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1480
Re: LAMW and Custom Drawing jListView Items
« Reply #3 on: April 09, 2019, 11:59:46 pm »

Hi, Robert.

What [jListView] text layout you nedd?

some hint:    left(center|centerbelow)right

the tags '(' and '|' will layout your text!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Robert Gilland

  • Full Member
  • ***
  • Posts: 146
Re: LAMW and Custom Drawing jListView Items
« Reply #4 on: April 10, 2019, 12:17:06 am »
Well the current jListview requirement is a simple <Image>.png| Long Description Text

But I foresee further jListViews will need maybe jGridView as they deal with Product data and therefore maybe multiple objects arranged in one List Item.

Robert Gilland

  • Full Member
  • ***
  • Posts: 146
Re: LAMW and Custom Drawing jListView Items
« Reply #5 on: April 10, 2019, 01:41:33 am »
Also, what sets the height of a jListItem of jListVIew? No setting I choose seems to do anything.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1480
Re: LAMW and Custom Drawing jListView Items
« Reply #6 on: April 10, 2019, 06:58:44 am »
Quote
what sets the height of a jListItem of jListVIew...?

You can try properties:  "ItemPaddingBottom" and "ItemPaddingTop"
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard