QListviewEx Component
Dreadsoftî Corporation
(manco un diritto riservato)
http://dreadsoft.too.it
dreadsoft@yahoo.it (Andreas Fink)

 

A bit complex, but with a lot of enhancements. Sorting, filtering, fastclear. Data can be loaded from (and saved to) files, Qmemorystream, Qfilestream. Support for CSV files. Very flexible layout.

QListViewEx Structure

Above you can see a "section" of the QListviewEx component

QlistviewEx is made by 4 components

- ParentPanel (Blue) is the main container, if you want to resize QlistviewEx you have to resize it. Other components will follow almost automatically
- Header (Red) contains new-style column headers
- QlistviewEx (Green) is the Qlistview component itself
- Colheader (Yellow) array of Qcoolbtn

 



QListViewEx Properties

Field Type R/W Notes
Parentpanel QPanel RW The panel which contains the listview and its header. The first thing to do is assign a parent to ParentPanel.
Header Qpanel RW Container for column headers
Colheader Array of Qcoolbtn RW Column header
Csv QSTRINGLIST RW Used to store data. It can get data directly from a file, Qmemorystream, Qfilestream (See Qstringlist documentation for details)
CsvFile STRING RW Filename of a CSV file
Separator STRING   Character(or string) used to separate columns in csv
FieldsCount INTEGER RW Number of fields(i.e. possible columns) found in the first string of csv
Columns_Count INTEGER RW Number of columns created with the addcol method (see below)
Flatheaders INTEGER   Determine if column headers have a 3D border

 

QListviewEx Methods

Method Type Description Params
Draw void    
Load Void Loads data from csv, separating each line in columns (using SEPARATOR)  
SortBy Sub (Criterium as String) See tutorial for details... 1
LoadFromCsvFile Void Loads data directly from csvfile, updating csv. Make sure the CsvFile Property is set  
FastClear Void Quicker cleaning function (not needed for long lists)  
Exclude sub (Column as integer, Criterium as string) Removes unwanted items searching for a specific value (Criterium) in the specified column  
AddCol sub (ColToAdd as string)

Use this one instead of the addcolumns method. To add columns, pass a single string containing headers captions, separated by "/"

Example:
Qlistviewex.addcol "First Name/Last Name/Address/Phone Number"

 
UpdateCsv void writes QlistviewEx data to csv  
Filter sub(column as integer, criterium as string) Keeps only specified items (see tutorial)  
SaveToCsvFile void updates CSV and writes data to csvfile  
SaveToFileAs void Save CSV to file (discarding QlistviewEx changes)  
DirecSaveAs void Saves QlistviewEx data without updating CSV  

 

The many ways to read / write data

 

Not quite clear yet ?

take a look at the tutorial