Windows listview on vfp forms

Published on by Yousfi Benameur

The listview is the main control used on windows applications as explorer for ex.
its not used too on visual foxpro, because the vfp grid is a main component of data visualisation.
the grid is more simple of utilisation but its have some limits.

if there is some common properties of the two controls, there is also some uncommon.
the listview was introduced as microsoft sample in vfp6 (download link below) but its all.No great use on place.
This sample itself was incomplet
.

I used in this code:
The listview shipped as olecontrol  with vfp as oleclass      :MSComctlLib.ListViewCtrl.2
the ole imageList control also shipped with vfp as oleclass :MSComctlLib.ImageListCtl.2
this is a starting demo with listview and shows some important properties and methods of this control
.

This is the head lines for the application i prepared for this purpose.    
There is 2 forms one as master , the second as slave(the great quantity of properties and method dont permit  me to work with one main form).

I make the navigation possible with these 2 forms (top level)
*the master form encapsulates  all important methods and properties of the listview drawn on slave form.

-i made the code independent of the table (can use any free table.its  converted to cursor for use-you can limit the fields imported also).there is an exception for the first column must dont numeric (bug with the listview).
-4 views possible (icons, smal icons,list,report)-( can add icons in imagelist olecontrol)
-allowColumnReorder
-checkboxes
-flatscrollbar
-fullrowSelect
-Gridlines
-HidecolumnHeaders
-Hide selection
-Hottracking
-hoverselection
-labeledit (manual)
-labelwrap
-MultiSelect
-Sorted
-setorder (ascending, descending)

-Arrange (auto top,auto left,none)
-Picture (any picture for listview backgroun)--alignment (top left,top right,bottom left,bottom right,centered,tiled)-can change main form backcolor.
for entire listview background picture use "tiled".
-cboSortkey: can select the column to sort
-All columns are made to be sorted ascending,descending (see the small bitmap on header-sort by click on header)
-Can set listview forecolor
-Can alternate listview forecolor
Can build a small image to be the background ao the cell listview and make some dynamick backcolors.these can be built with 0,1,2,3 directions (test on form) with API or with gdiplusX.i make the 2 codes (one of gdiplusX  disabled)
-the navigation between master form and slave form is possible by button.

*the slave form draw the listview with the directives of master forms
-can set fontname,fonsize for the listview
-the bold,italiud,underline,strikeout with the fonr
-with the selected row can make bold,checked,ghosted,selected, tooltip
-can find an item on listview
-can set the forecolor of the row selected
-can edit the row in an editbox and raise a contectuel menu to select all+copy

-Can make an html report (rendered with css)  or a quick vfp  report from the listview contents

you can download  the complet project and test it.Can compile the proj and build an exe for one table used.

 

*The row height is read only and cannot be adjusted by code directly.must increase or decrease the fontsize to adjust it

*can dblclick on form yslave titlebar to make a fullscreen or restore initial window.

More stuffs can be added to this application as
-finditem
-working with  unicode
-print

some screenshots produced by the listview application.
some screenshots produced by the listview application.
some screenshots produced by the listview application.
some screenshots produced by the listview application.
some screenshots produced by the listview application.
some screenshots produced by the listview application.
some screenshots produced by the listview application.
some screenshots produced by the listview application.

some screenshots produced by the listview application.

Comment on this post

Jun Tangunan 04/28/2015 01:40

Hey Yousfi, I did not realized you've posted already a lot here. Thanks for the tutorials. I will visit here often as I am sure I may learn and use some of your tricks on my end. Keep up the good work!

Yousfi Benameur 04/28/2015 09:52

Hi Jun and welcome and thank you for the visit!
keep free to make suggestions or comments or export stuffs.I made this blog for this goal.
thank you !