mfcobol2002
Programmer
NetX/Dialog System: ListView - Part-1
Problem:
The field of a listview is alphanumeric, soon a column containing dates with the format DD/MM/YYYY when sorted by the header they would be for us unsorted as dates and ordered alphabetically.
solution:
we created an extra column in the listview with size zero and containing the dates in the format YYYY/MM/DD.
imagine: the column 4 would have the format DD/MM/YYYY and the column 7 would have the format YYYY/MM/DD.
we altered the control program generated by Dialog System in the following way:
local-storage section.
01 num-col pic x(4) comp-5.
--------------------------
Register-Callbacks section.
MOVE '"' & ProgramID & z'Clicked"' TO MessageName
INVOKE EntryCallback "new" USING MessageName
RETURNING aCallback
MOVE P2ce-clicked To i
INVOKE aControl "setEvent" USING i aCallback
INVOKE aCallback "finalize" RETURNING aCallback
*>
-------------------------------------
sortOnColumn section.
Entry ProgramID & "Clicked" USING anEvent.
PERFORM GetDataBlockPointer
INVOKE anEvent "getSelectedItem" RETURNING num-col
if num-col = 4
Move 7 To num-col
Invoke aControl "SortOnColumn" using num-col
End-If
EXIT PROGRAM
.
*>----------------------------------------------------------------
Marcos A.S.
Brasil
Problem:
The field of a listview is alphanumeric, soon a column containing dates with the format DD/MM/YYYY when sorted by the header they would be for us unsorted as dates and ordered alphabetically.
solution:
we created an extra column in the listview with size zero and containing the dates in the format YYYY/MM/DD.
imagine: the column 4 would have the format DD/MM/YYYY and the column 7 would have the format YYYY/MM/DD.
we altered the control program generated by Dialog System in the following way:
local-storage section.
01 num-col pic x(4) comp-5.
--------------------------
Register-Callbacks section.
MOVE '"' & ProgramID & z'Clicked"' TO MessageName
INVOKE EntryCallback "new" USING MessageName
RETURNING aCallback
MOVE P2ce-clicked To i
INVOKE aControl "setEvent" USING i aCallback
INVOKE aCallback "finalize" RETURNING aCallback
*>
-------------------------------------
sortOnColumn section.
Entry ProgramID & "Clicked" USING anEvent.
PERFORM GetDataBlockPointer
INVOKE anEvent "getSelectedItem" RETURNING num-col
if num-col = 4
Move 7 To num-col
Invoke aControl "SortOnColumn" using num-col
End-If
EXIT PROGRAM
.
*>----------------------------------------------------------------
Marcos A.S.
Brasil