Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

listview control

Status
Not open for further replies.

sansome

Technical User
Nov 8, 2001
2
0
0
GB
I need to add items to a listview. I have read the fujitsu samples but don't fully understand them.

What am I doing wrong ?
I what to add the following -

01 ws-details.
03 ws-dets-1 pic 999.
03 ws-dets-2 pic xxxx.
03 ws-dets-3 pic xxxx.

e.g invoke listview-details "add" using ws-details
 
See this if can help you

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ws-details.
03 ws-dets-1 pic 999.
03 ws-dets-2 pic xxxx.
03 ws-dets-3 pic xxxx.
01 CONTROLLI.
03 POW-PCMLIST OBJECT REFERENCE POW-CLISTITEM.
03 WK-IDX PIC S9(9) COMP-5.
PROCEDURE DIVISION.
A.
MOVE 0 TO WS-DETS-1
INVOKE CM-LISTA "Clear".

A-1.
ADD 1 TO WS-DETS-1
IF WS-DETS-1 = 10 GO TO FINE.

MOVE "UNO" TO WS-DETS-2
MOVE "PROVA" TO WS-DETS-3

INVOKE CM-LISTA "Add" USING 1 1 RETURNING WK-IDX.
MOVE "ListItems"(WK-IDX) OF CM-LISTA TO POW-PCMLIST.

MOVE WS-DETS-1 TO "Numeric"(1) OF POW-PCMLIST
MOVE WS-DETS-2 TO "Text"(2) OF POW-PCMLIST
MOVE WS-DETS-3 TO "Text"(3) OF POW-PCMLIST

GO TO A-1.

FINE.
EXIT PROGRAM.
fsccdm
 
Thanks - it works. The "Text" and "Numeric" have to start with a capital letter (I am told it is a bug!!)

My next problem is understanding how to move a value from a cell to a variable. Again, the example is a bit long winded. You example was much easier to understand and modify for use.

Kindest Regards
 
If you want move data from list-view:

on itemclick event of control list-view (only on first column click)

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 POW-PLISTITEM OBJECT REFERENCE POW-CLISTITEM.
PROCEDURE DIVISION USING POW-PLISTITEM.
A.
MOVE "Numeric"(1) OF POW-PLISTITEM TO "Text" OF CMTEXT1
MOVE "Text"(2) OF POW-PLISTITEM TO "TExt" OF CMTEXT2
MOVE "Text"(3) OF POW-PLISTITEM TO "TExt" OF CMTEXT3
*> OR WHERE YOU WANT


if you want the sort of data ascending or descending
on columnclick event

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 POW-COLUMNINDEX PIC S9(9) COMP-5.
PROCEDURE DIVISION USING POW-COLUMNINDEX.
A.
*> FOR PIC X(n) DATA
MOVE 0 TO "SortKind" OF CM-LISTA
MOVE 1 TO "SortOrder" OF CM-LISTA
MOVE POW-COLUMNINDEX TO "SortColumn" OF CM-LISTA
*> FOR NUMERIC DATA
IF POW-COLUMNINDEX = 1
MOVE 1 TO "SortKind" OF CM-LISTA
MOVE 2 TO "SortOrder" OF CM-LISTA
END-IF.

EXIT PROGRAM.
**********
if you want sort data when you create the list

FINE.
*> MOVE THE COLUMN NUMBER TO SORT 1-2-3
*> 2 FOR WS-DETS-2
MOVE 2 TO "SortColumn" OF CM-LISTA
EXIT PROGRAM.
*****************
for more see properties and methods on help of PowerCOBOL and try it.
hope helpful
fsccdm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top