TAdvListView & TDBAdvListView documentation (v1.51) © by TMS software
Installation - Procedures - Properties - Events - Info - Main page

Info

TAdvListView is now released as v1.51. 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 50USD. 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. For other payment possibilities, contact TMS software at info@tmssoftware.com
Installation

Delphi 2 : In the Options menu, Install component, Add and browse for alvreg.pas
Delphi 3, Delphi 4,Delphi 5, C++Builder 3, C++Builder 4: In the Component menu, select Install component, Choose either into existing package or a new package. Browse for alvreg.pas.
C++Builder 1.0 : In the Options menu, select Install component, Add and browse for alvreg.pas.
Important notice for upgrades : If you have a previous version of TAdvListView or TDBAdvListView installed, make sure you check the following items :
- uninstall the version in use, and remove all AdvListView component related files (ADVLISTV.*, ALVPKG.*, DBADVLST.*)
- extract the new files into your component directory or a separate directory
- for projects using TAdvListView or TDBAdvListView, first open all forms that contain either one of the listview controls, ignore are errors related to properties and save the form. After this, proceed with application compilation.

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 InputFromCSV(filename:string);
Description : Loads the contents of the listview from a CSV file and appends it to the existing items in the listview control. Use Delimiter property to set the column
procedure LoadFromStream(stream;tstream);
Description : Loads the contents of the listview from a stream.
procedure SaveToStream(stream;tstream);
Description : Saves the contents of the listview to a stream.
procedure LoadFromFile(filename:string);
Description : Saves the contents of the listview to a file.
procedure SaveToFile(filename:string);
Description : Saves the contents of the listview to a file.

procedure SaveToHTML(filename:string);
Description : Saves the contents of the listview as a HTML file with a table. Uses the HTMLSettings property for several formatting options
procedure SaveToXML(FileName, ListDescr, RecordDescr: String; FieldDescr : tstringlist);
Description : saves contents of stringgrid as XML file. ListDescr specifies the XML list descriptor name, RecordDescr the record descriptor name and FieldDescr is a stringlist holding the field names for each column of the grid. Fixed columns and rows are not saved to XML.
procedure SaveToDOC(filename:string);
Description : Saves the contents of the listview as a MS Word .DOC file
procedure SaveToASCII(filename:string);
Description : Saves the contents of the listview to a formatted text file.
procedure SaveToXLS(filename:string);
Description : Saves the contents of the listview as a MS Excel .XLS file
procedure LoadFromXLS(filename:string);
Description : Loads the contents of the listview from a MS Excel .XLS file

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)
procedure MoveItem(aIdx1,aIdx2:integer);
Description : Moves the item in the list from position aIdx1 to position aIdx2 (zero based index)
procedure SwapItems(aIdx1,aIdx2:integer);
Description : Swaps item at position aIdx1 and aIdx2 (zero based index)
procedure MoveColumn(aIdx1,aIdx2:integer);
Description : Moves column aIdx1 to position aIdx2 (zero based index)
procedure SwapColumns(aIdx1,aIdx2:integer);
Description : Swaps column aIdx1 and aIdx2 (zero based index)
procedure CopyToClipboard;
Description : Copies full content of the listview to the clipboard
procedure CopySelectionToClipboard;
Description : Copies selected content of the listview to the clipboard
procedure CutToClipboard;
Description : Cuts selected content of the listview to the clipboard
procedure PasteFromClipboard;
Description : Paste text data from clipboard to the listview control
procedure GetFilter(index:integer;filtertype:integer):string;
Description : Gets the value of a filterbar item index. The filtertype can be 0 for strings, 1 for numeric data.
procedure SetFilter(index,filtertype,ivalue:integer;sValue:string);
Description : Sets the value and type of a filterbar item index. The filtertype can be 0 for strings, 1 for numeric data. If the data is numeric, the filterbar value is in iValue, if data is a string, sValue contains the string value.

Properties

property ItemHeight:integer;
Description : Sets the row height.
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 HeaderFont:TFont;
Description : Property that sets the font of the listview header
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 SelectionTextColor:TColor;
Description : Property that sets the selection tex color.
property SelectionRTFKeep:boolean;
Description : If true, prevents the item that contain rich text from changing colors when it is in the selected state.
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 DateFormat : string; : holds the date formatting parameter. Default value is dd/mm/yyyy
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 JobName : sets title for print job in printer spooler
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 PageSuffix : string : sets the suffix for page numbering for printout
property PageNr: TPrintPosition; : sets position on page of page number
property PageNumSep:string; sets the separator between actual printed page and total nr. of pages. If PageNumSep is a zero length string, total number of pages is not printed. Default value is '/'
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,pbAround,pbAroundHorizontal,pbAroundVertical);
TPrintOrientation = (poLandscape,poPortrait)
TFitToPage = (fpNever,fpGrow,fpShrink,fpAlways,fpCustom)
property HTMLSettings:THTMLSettings;
Description : property controlling several options for the SaveToHTML function.
BorderSize : table border size in HTML
CellSpacing : table cellspacing in HTML
FooterFile : file that is optionally appended at the end of the HTML for the grid content.
HeaderFile : file that is optionally included before the grid content
PrefixTag : optional HTML tags included before the grid content HTML code
SuffixTag : optional HTML tags included after the grid content HTML code
SaveColor : when true, color information is saved in HTML
SaveFonts : when true, font information is saved in HTML
TableStyle : optional table style tags for HTML
Width : width in % of the HTML table
property SortColumn:integer;
Description : Sets the primary sort column.
property SortDirection: TSortDirection;
Description : Sets the sort direction to either : sdAscending or sdDescending.
property SortUpGlyph: TBitmap;
Description : Sets the sort direction glyph for sort up direction.
property SortDownGlyph: TBitmap;
Description : Sets the sort direction glyph for sort down direction.
property SortIndicator: TSortIndicator;
Description : Indicates the position of the sort indicator, ie. either right or left of column header text.
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 Wallpaper;
Description : Sets the listview background image.
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 or inifile.
property Key:string; : key in registry or inifile where sizes are stored
property Section:string; : section in registry or inifile where sizes are stored
property Stretch:boolean; : automatic stretching of rightmost column to full listview size
property Storage:TSizeStorage : determines whether the registry or an inifile is used to store the values. With TSizeStorage = (stInifile,stRegistry)
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.
property SubItemEdit:boolean;
Description : If true, allows listview items as well as subitems to be edited. Make sure RowSelect is false when using SubItemEditing.
property SubItemSelect:boolean;
Description : If true, allows listview items as well as subitems to be selected. Make sure RowSelect is false when using SubItemEditing. If subitems need to be edited, set SubItemEdit to true.
property ClipboardEnabled:boolean;
Description : If true, allows clipboard functions Cut, Copy, Paste to be activated by pressing Ctrl-Ins, Shift-Ins, Shift-Del or the alternate shortcuts Ctrl-X, Ctrl-V, Ctrl-C
property FilterBar:boolean;
Description : If true, shows the filter. This feature is only available if COMCTL32 v5+ is installed. Events OnFilterChange, OnFilterBtnClick are triggered through interaction with the filter bar.
property FilterTimeout:integer;
Description : If the filterbar is displayed, determines the nr. millieseconds to wait before the OnFilterChange is called when the filter is edited.

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.
property OnLeftClickCell: TClickCellEvent;
Description : Event is called when user clicks a item or subitem and returns itemindex as well as subitemindex.
property OnRightClickCell:TClickCellEvent;
Description : Same as OnLeftClickCell, but for right mouse button..
property OnColumnRClick: TClickCellEvent;
Description : Event is called when user clicks the column header with right mouse cell.
property OnFilterChange: TFilterChangeEvent;
Description : Event is called when user edits in the filterbar after nr. of millieseconds specified in the FilterTimeout property.
property OnFilterBtnClick: TFilterBtnClick;
Description : Event is called when user clicks a button in the filterbar.
property OnAnchorClick: TLVAnchorClick;
Description : Event is called when user clicks an anchor in a HTML formatted item.
property OnAnchorEnter: TLVAnchorEnter;
Description : Event is called when the mouse moves over an anchor in a HTML formatted item.
property OnAnchorExit: TLVAnchorExit;
Description : Event is called when the mouse leaves an anchor in a HTML formatted item.
property OnCanEditCell: TCanEditCell;
Description : Event is called before an item enters into edit mode to allow read-only items / subitems.