tlistview

how auto size the columns width of a list view in virtual mode?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 23:40:00
When I use a TListView (ViewStyle = vsReport) I can autofit the width of the columns setting the LVSCW_AUTOSIZE or LVSCW_AUTOSIZE_USEHEADER values in the Width property of each column, now I start to use the Listview in virtual mode, but the width of the columns is not modified according to these values. So the question is : How I can adjust the width of the columns to fit to the content or header, when the lisvtiew is in virtual mode? Since the list view in virtual mode don't know the item captions in advance (because it asks only for data of the visible area) it also cannot know the width of

Delphi - Get and Set Scrollbar Position of a ListView

怎甘沉沦 提交于 2019-12-03 13:45:44
It might seem like a silly & simple question, and yet, I've been unable to find a satisfying answer. Basically, I have a TListview (style = vsReport) with data. Sometimes, I have to update it, and therefore, I have to clear the listview and fill it again with the updated data. However, when I do that, the scrollbar position is reseted to 0. I would like to be able to get the scrollbar position before the clearing and set it back to what it was before. If the updated data has the exact same amount of rows as the old data, I need the scrollbar to be at the exact same position as before; if not,

TListView: VCL loses the order of columns if you add a column

孤街浪徒 提交于 2019-12-01 05:11:36
I'm trying to add a column between existing columns in a TListView. Therefor I add the new column at the end and move it by setting it`s index to the designated value. This works, until adding another new column. What I did: Add the column at last position (Columns.Add) and add the subitem at the last position (Subitems.Add) too. Afterwards I move the column by setting it's index to the correct position. This works fine as long as it's just one column that gets added. When adding a second new column, the subitems get screwed up. The new subitem of the first column is moved to the last position

TListView: VCL loses the order of columns if you add a column

浪子不回头ぞ 提交于 2019-12-01 02:51:27
问题 I'm trying to add a column between existing columns in a TListView. Therefor I add the new column at the end and move it by setting it`s index to the designated value. This works, until adding another new column. What I did: Add the column at last position (Columns.Add) and add the subitem at the last position (Subitems.Add) too. Afterwards I move the column by setting it's index to the correct position. This works fine as long as it's just one column that gets added. When adding a second new

how to sort in Tlistview based on subitem[x]

℡╲_俬逩灬. 提交于 2019-11-30 19:19:33
How to sort in tlistview with data present in subitem[x] ? Set SortType := stData and write procedure TForm1.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer); begin Compare := StrToInt(Item1.SubItems[x]) - StrToInt(Item2.SubItems[x]) end; for instance. If compare is negative, Item1 should come before Item2; if compare is positive, the opposite applies. Thus this example, which assumes that SubItem[x] contains an integer, will sort the items according to the numerical value of SubItem[x]. If, on the other hand, SubItem[x] contains strings, then you

drawing a checkbox in a TListView

折月煮酒 提交于 2019-11-30 07:31:48
问题 I need to draw a checkbox in a particular column in a TListView , so i check this question How can I setup TListView with CheckBoxes in only certain columns? and in the accepted answer suggest use the method described in this another question How to set a Checkbox TStringGrid in Delphi?, now porting that code to work with a ListView i come with this : procedure TForm15.ListView1CustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: Integer; State: TCustomDrawState; var

how to sort in Tlistview based on subitem[x]

a 夏天 提交于 2019-11-30 04:08:51
问题 How to sort in tlistview with data present in subitem[x] ? 回答1: Set SortType := stData and write procedure TForm1.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer); begin Compare := StrToInt(Item1.SubItems[x]) - StrToInt(Item2.SubItems[x]) end; for instance. If compare is negative, Item1 should come before Item2; if compare is positive, the opposite applies. Thus this example, which assumes that SubItem[x] contains an integer, will sort the items

drawing a checkbox in a TListView

孤者浪人 提交于 2019-11-29 04:31:05
I need to draw a checkbox in a particular column in a TListView , so i check this question How can I setup TListView with CheckBoxes in only certain columns? and in the accepted answer suggest use the method described in this another question How to set a Checkbox TStringGrid in Delphi? , now porting that code to work with a ListView i come with this : procedure TForm15.ListView1CustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean); const PADDING = 4; var h : HTHEME; s : TSize; r : TRect; Rect : TRect; i : Integer; Dx :

Create a customized Item Appearance for ListView Delphi XE7

梦想的初衷 提交于 2019-11-27 14:55:02
Im having a lot of trouble trying to create a customized item appearance for the TListView firemonkey control for Delphi XE7. What I want is to define my own "design" for what an item should be and use that item. For example : I would like to have an item with a Title(on top) - A Description(Middle) - A Date (Bottom) - Button(Right). I could not find any good documentation about this but i got some samples of how to create an TListView with muti details, but the problem is : that sample is not documented so is very hard to understand whats going on there. I would like to have a link or some

Delphi TListview OwnerDraw SubItems - change default font (it's bold somehow after you Draw on the canvas)

一个人想着一个人 提交于 2019-11-27 07:59:32
问题 If you use ownerdraw with a TListView, the subitems are all BOLD font style by default somehow, even if the listview font.style is set to [], for all the SubItems following a custom drawn one. A workaround I found is forcing the Style set in the CustomDrawSubItem event: ListView2.Canvas.Font.Style := [fsItalic]; ListView2.Canvas.Font.Style := []; (a simple call with [] won't work unless the default style is set to something other than [], because the SetStyle call doesn't think the style has