Using report view
ListView report view requires more information than the large
icon, small icon, and list view. To enable report view in a ListView
control, you must write a script that establishes columns with the
AddColumn and SetColumn functions, and then populate the columns using
the SetItem function.
Populating columns
Use AddColumn to create columns in a ListView. When you use the
AddColumn function, you specify the:
-
Column label
The name that will display in the column header
-
Column alignment
Whether the text will be left-aligned, right-aligned, or
centered -
Column size
The width of the column in PowerBuilder units
This example creates three columns in a ListView:
|
1 2 3 |
This.AddColumn("Name", Left!, 1000) This.AddColumn("Size", Left!, 400) This.AddColumn("Date", Left!, 300) |
Setting columns
Use SetColumn to set the column number, name, alignment, and
size:
|
1 2 3 |
This.SetColumn (1, "Composition", Left!, 860) This.SetColumn (2, "Album", Left!, 610) This.SetColumn (3, "Artist", Left!, 710) |
Setting column items
Use SetItem to populate the columns of a ListView:
|
1 2 3 4 5 6 7 8 9 |
This.SetItem (1, 1, "St.Thomas") This.SetItem (1, 2, "Saxophone Colossus") This.SetItem (1, 3, "Sonny Rollins") This.SetItem (2, 1, "So What") This.SetItem (2, 2, "Kind of Blue") This.SetItem (2, 3, "Miles Davis") This.SetItem (3, 1, "Good-bye, Porkpie Hat") This.SetItem (3, 2, "Mingus-ah-um") This.SetItem (3, 3, "Charles Mingus") |
For more information about adding columns to a ListView control,
see the section called “AddColumn” in PowerScript Reference.