AdvListView documentation (v1.3)
© by TMS software




Installation - Procedures - Properties - Events - Info - Delphi page

Info

TAdvListView is now released as v1.3. We want to thank all users for their input, either reporting problems or giving usefull suggestions for enhancements. We always look forward to hear your inputs and requests for features to enhance the component even more.
TAdvListView is free for use in non-commercial applications, that is applications which are not being sold in any form or applications that are not used for commercial or profitable purposes. Source code and license are available for $50. Registered users are entitled to free source code updates for all 1.x versions and support by email within 24hrs. You can do online registration TAdvListView through the ShareIt service or payment is possible by sending a check, cash, postal order or bank transaction to :

TMS software
J. Jordaens str 11
B8510 Marke
fax: +32/56 359696
email :
tms@theLinx.com

If required, TMS software can send you an invoice. To save banking costs, use local currency. For example :
Belgium : 1800 BEF
Netherlands : 100 Gulden
Germany : 85 DEM
France : 300 FF
UK : 30 GBP

Installation

Delphi 2 : In the Options menu, select Install component, Add and browse for advlistv.dcu

Delphi 3, Delphi 4
: In the Component menu, select Install packages, Add and browse for alvpkg.dpl.

C++Builder 1.0
: In the Options menu, select Install component, Add and browse for advlistv.obj.

C++Builder 3.0
: In the Component menu, select Instal packages, Add and browse for alvpkg.bpl.

Procedures

procedure SaveToCSV(filename:string);
Description
: Saves contents of the listview in a CSV file. Use Delimiter property to set the column delimiter. Use the SaveHeader property to save header text as well.

procedure LoadFromCSV(filename:string);
Description
: Loads the contents of the listview from a CSV file. Use Delimiter property to set the column delimiter. Use the LoadHeader property to load the header text as well.

procedure SaveToHTML(filename:string);
Description
: Saves the contents of the listview as a HTML file with a table.

procedure Clear;
Description
: Clears all item in the list.

procedure Sort;
Description
: Performs sorting of the listview based on the column indicated by the SortColumn property and direction is indicated by the SortDirection property..

procedure Print;
Description : Prints the listview data with setting in PrintSettings property

procedure Preview(canvas:tcanvas;displayrect:trect);
Description : Previews the listview on the canvas within the rectangle displayrect.

procedure StretchRightColumn;
Description : Stretches the rightmost column so that all data fits in the listview view.

procedure AutoSizeColumn(i:integer);
Description : Sizes the column to the max. text size in the column so that all text is fully visible

procedure AutoSizeColumns;
Description : Resizes all columns to make all text fully visible.

procedure LoadColumnSizes;
Description : Loads column sizes from registry (settings in the ColumnSize property)

procedure SaveColumnSizes;
Description : Saves column sizes into the registry (settings in ColumnSize property)

Properties

property ItemHeight:integer;
Description
: Sets the row height.
f
property Hottrack:boolean;
Description
: When true, allows hover track selection of the items in the listview control.

property LoadHeader:boolean;

Description
: Used when calling LoadFromCSV. Determines if the header is also loaded from the CSV file.

property SaveHeader:boolean;

Description
: Used when calling SaveToCSV. Determines if header is saved too in the CSV file.

property Headerhottrack:boolean;
Description
: When true, allows hover track selection in the listview header.

property HeaderDragDrop:boolean;
Description
: When true, allows column reordering by drag & drop with mouse over headers.

property HeaderFlatStyle:boolean;
Description
: When true, displays the header in flat Win98 style.

property HeaderImages:TImageList;
Description
: Property that holds the images that can be used to attach to the header. Use the ColumnImages[column:integer] property to set the index of the image and set ColumnImage[colum:integer] to -1 to remove the image.

property ColumnImages[column:integer]:integer;
Description
: Sets the image of the column header to the specified image in the HeaderImages imagelist.

property SelectionColor:TColor;

Description
: Property that sets the selection color.

property PrintSettings:TPrintSettings;
Description
: Property to hold all printout settings :

property Time: TPrintPosition; : sets position on page of time of printout.
property Date: TPrintPosition; : sets position on page of date of printout
property PageNr: TPrintPosition; : sets position on page of page number
property Title: TPrintPosition; : sets position of title of printout
property TitleText : string; : sets title of printout
property Font: TFont; : sets font of printout
property HeaderFont  : sets font for the header
property FooterFont : sets font for the footer
property Borders : TPrintBorders; : sets drawing method of borders for printout
property BorderStyle : TPenStyle; : line drawing style for border
property Centered : boolean; : if true, printout is centered on the page.
property RepeatFixedRows : boolean; : if true, printout of fixed rows is repeated on each page.
property RepeatFixedCols : boolean; : if true, printout of fixed columns is repeated on each page.
property FooterSize : integer : controls distance to skip at start of page in units of 1/10mm.
property HeaderSize : integer : controls distance to skip at end of page in units of 1/10mm.
property LeftSize : integer : controls distance to skip at left side of page in units of 1/10mm.
property RightSize : integer : controls distance to skip at right side of page in units of 1/10mm.
property ColumnSpacing : integer : controls distance to skip between 2 columns in units of 1/10mm.
property RowSpacing : integer : controls distance to skip between 2 columns in units of 1/10mm.
property Orientation : TPrinterOrientation : sets printer orientation to landscape or portrait
property PagePrefix : string : sets the prefix for page numbering for printout
property FixedHeight : height of rows for printout in 0.1mm
property FixedWidth : width of columns for printout in 0.1mm
property UseFixedHeight : if enabled, uses value FixedHeight, else auto calculation is done
property UseFixedWidth : if enabled, uses value FixedWidth, else auto calculation is done
property FitToPage: Controls various options to fit printing on a page.
- fpNever : never use page fitting.
- fpAlways : always fit to page, no matter what the scalefactor is
- fpGrow : only fit to page by increasing font size / column widths
- fpShrink : only fit to page by decreasing font size / column widths
- fpCustom : call the OnFitToPage event, to query for allowing pagefit with calculated scalefactor.

with
TPrintPosition = (ppNone,ppTopLeft,ppTopRight,ppTopCenter,ppBottomLeft,ppBottomRight,ppBottomCenter);
TPrintBorders = (pbNoBorder,pbSingle,pbDouble,pbVertical,pbHorizontal);
TPrintOrientation = (poLandscape,poPortrait)
TFitToPage = (fpNever,fpGrow,fpShrink,fpAlways,fpCustom)

property SortColumn:integer;

Description
: Sets the primary sort column.

property SortDirection: TSortDirection;

Description
: Sets the sort direction to either : sdAscending or sdDescending.

property FlatScrollBar:boolean;

Description
: Displays the scrollbars in Win98 flat style.

property URLShow:boolean;
Description
: makes listview URL-aware and displays clickable URLs.

property URLFull:boolean;

Description
: If true, displays full URL, ie including protocol prefix.

property URLColor:tcolor;

Description
: color used to display URLs.

property SizeWithForm:boolean;
Description
: If true, the listview resizes itself when the parent form also resizes.

property VAlignment;
Description
: Sets vertical alignment of text.

property AutoHint;

Description
: When true, displays a hint when text does not fit in a column and is displayed with an ellipsis.

property ColumnSize:TColumnSize;
Description
: property to hold settings for saving column sizes.

property Save:boolean; : if true, column sizes are saved into registry.
property Key:string; : key in registry where sizes are stored
property Section:string; : section in registry where sizes are stored
property Stretch:boolean; : automatic stretching of rightmost column to full listview size

property PrintPageWidth:integer;
Description
: Read-only property indicates the width of the listview on the current printed page. Property is valid during OnPrintPage event handler.

property PrintColStart:integer;
Description
: Read-only property indicates the column index of the first printed column on the current printed page. Property is valid during OnPrintPage event handler.

property PrintColEnd:integer;
Description
: Read-only property indicates the column index of the last printed column on the current printed page. Property is valid during OnPrintPage event handler.

property PrintColWidth[Acol:integer]:integer;
Description
: Read-only property indicates the width of column ACol on the current printed page. Property is valid during OnPrintPage event handler.

property PrintColOffset[Acol:integer]:integer;
Description
: Read-only property indicates the offset from left margin of the column ACol on the current printed page. Property is valid during OnPrintPage event handler.

Events

property OnDrawItemProp: TDrawItemProp;
Description : Is called when OwnerDraw property is set true. Provides an easy way to format text displayed in the listview.

with : TDrawItemProp = procedure (Sender:TObject;itemindex,subitemindex:integer; AState: TOwnerDrawState; ABrush:TBrush;AFont:TFont; ItemText:String) of object;

Change the ABrush and AFont parameters to change display colors and fonts.

property OnGetFormat: TFormatEvent;
Description : Is called when performing sorts. Determines the datatypes in the listview columns to use for sorting.

with :
TFormatEvent = procedure (Sender : TObject; ACol:longint;var AStyle:TSortStyle; aPrefix,aSuffix:string) of object;
TSortStyle can be ssAutomatic, ssAlphabetic, ssNumeric, ssDate, ssAlphaCase, ssAlphaNoCase, ssShortDateEU, ssShortDateUS, ssCustom.

Use aSuffix or aPrefix when this text must not be considered for the sort

property OnCustomCompare:TCustomCompareEvent;
Description : Method is called when the ssCustom sorting style is specified in the TFormatEvent.

property OnSortStart:TSortStartEvent;
Description : Event is called before sorting starts. Can be used to display a wait cursor.

property OnSortDone:TSortDoneEvent;
Description : Event is called when sorting is done. Can be used to switch cursor back to the default arrow.

property OnPrintPage:TPrintPageEvent;
Description
: event handler called when a page is printed (either on hardcopy or during printpreview). This event handler creates the possibility to add custom drawing to the printing process. The Canvas is passed as a parameter and can be used to draw. Notice that changing canvas settings such as pen, font, brush affect printing other data. If a setting like a font must be changed for the custom printing process, the original settings must be restored. This can be done in following way for a font for example :

savefont:=tfont.create;
savefont.assign(font);
//do custom drawing here and change font
font.assign(savefont);
savefont.free;

Printing is done in a canvas set to MM_LOMETRIC. This means that all units are in 1/10mm and page coordinates go from 0,0 to xsize,-ysize. There are no restrictions to the position where custom drawing is done.

property OnPrintNewPage:TPrintNewPageEvent;
Description
: event handler called after printing each row to query to start a new page. The parameter is the current row being printed, and NewPage is a boolean that can be set true to start printing on a new page.

property OnPrintSetColumnWidth::TPrintSetColumnWidth;
Description
: event handler called to overrule the automatically calculated column widths. Use this event handler if you need to exactly define column widths for printing. All dimensions are in 1/10mm.

property OnFitToPage :TDoFitToPageEvent;
Description
: event handler to query for allowing fit to page with calculated scalefactor.

TDoFitToPageEvent = procedure(Sender:TObject;var scalefactor:double;var allow:boolean);

Set allow to false to disable fit to page, or change the scalefactor programmatically.. property property

OnStartColumnTrack:TStartColumnTrackEvent;
Description : Event is called when user is about the resize a column by means of the header. Set Allow to false to disable column resizing.

property OnEndColumnTrack:TEndColumnTrackEvent;
Description : Event is called when user has finished resizing a column.