Share Tips, Code Samples, etc. with the Visual Prolog community.
Post Reply
Harrison Pratt
VIP Member
Posts: 453
Joined: 5 Nov 2000 0:01

ListViewSupport Demo project

Post by Harrison Pratt »

** listViewSupport_Demo demonstrates use of the the glinda_LISTVIEW package.

This package supports
* automatic sizing of a listview control to fit contents and resizing of the containing dialog,
* automatic setting of column widths and right alignment of numeric and date fields,
* simple field editing,
* various return value options are possible, including returning only the changed values in an edited listview control or specific fields of a selected row

For demonstration, the directory "Data Files" under the "Exe64" directory contains several sample CSV files.
These files all have the extension "csv" but have different field separators, e.g. comma, semicolon, tab, or pipe
Also, some sample files have quoted fields and some do not.

For more information, see the HTML or MD files in the glinda_LISTVIEW package folder.

The csvReader_PKG included in listViewSupport_Demo is a convenient way to read character-separated text files.

Field separators are automatically detected by a csvSpy object.
Valid separators are ',', ';', tab and '|' characters
Quoted fields, if any, are parsed and dequoted automatically.
A valid data row can have any number of quoted fields.
Escaped and embedded quotes are NOT handled, however.
Labelled versus unlabelled file handling is controlled by the csvReader constructors.

** ListViewSupport_Demo.zip updated Feb. 27, 2024, to fix problem with text file inclusion constant noted by drspro2 below. There are no changes in the two demonstration packages.
Attachments
ListViewSupport_Demo.zip
Replaces previous version
(97.47 KiB) Downloaded 240 times
Last edited by Harrison Pratt on 27 Feb 2024 14:33, edited 1 time in total.
User avatar
drspro2
VIP Member
Posts: 103
Joined: 28 Apr 2006 12:03

Re: ListViewSupport Demo project

Post by drspro2 »

dear Harrison,

it should be loaded in VP11?


in VP10 it asks to add and delete packages
Harrison Pratt
VIP Member
Posts: 453
Joined: 5 Nov 2000 0:01

Re: ListViewSupport Demo project

Post by Harrison Pratt »

There is nothing incompatible with VIp10.
It is common to have to remove/add VP support packages when you migrate between major versions and the IDE usually handles that well -- although, I have not done a backwards project migration.
Go ahead and let the IDE have what it wants.

I'll double-check the "include" directories on the project and see if that's an issue.
Harrison Pratt
VIP Member
Posts: 453
Joined: 5 Nov 2000 0:01

Re: ListViewSupport Demo project

Post by Harrison Pratt »

There is an issue with the display being in an order that is the reverse of the input data.
You can fix that in lvSupport.pro at line 36.

Code: Select all

clauses     init_listviewControl() :-         lvControl:setLvType(listViewControl::lvs_report),         (inputLabels = [] and lvControl:setStyle([listViewControl::lvs_noColumnHeader]) orelse succeed),         lvControl:insertColumnList(0, mk_Columns()), %        lvControl:insertItemList(mk_Items()).         lvControl:insertItemList(list::reverse(mk_Items())). % HWP 2024-02-09
User avatar
drspro2
VIP Member
Posts: 103
Joined: 28 Apr 2006 12:03

Re: ListViewSupport Demo project

Post by drspro2 »

it works, after delete all and Add all it will compile in VP10


only had to remove 2 string constants manually


thankyou
Harrison Pratt
VIP Member
Posts: 453
Joined: 5 Nov 2000 0:01

Re: ListViewSupport Demo project

Post by Harrison Pratt »

These two constants in appSupport_PKG/msg.pro ?

Code: Select all

constants     startupMsg : string = #stringinclude(@"..\listViewSupport_Demo\appSupport_PKG\startUpMessage.txt").     hotkeyMsg : string = #stringinclude(@"..\listViewSupport_Demo\appSupport_PKG\hotKeyMessage.txt").
User avatar
drspro2
VIP Member
Posts: 103
Joined: 28 Apr 2006 12:03

Re: ListViewSupport Demo project

Post by drspro2 »

Yes very correct
Harrison Pratt
VIP Member
Posts: 453
Joined: 5 Nov 2000 0:01

Re: ListViewSupport Demo project

Post by Harrison Pratt »

The #stringinclude Issue is corrected in my edit of the original post.
Thanks go to drspro2 for pointing it out.
Post Reply