...
SCREEN SECTION.
...
05 label
title "Combo-Box"
line 5
col 31
lines 5 cells
size 10 cells
.
05 cb1 combo-box
line 5 col 44
size 15
id 401
.
05 label
title "List-Box"
line 7 col 31
size 8 cells
.
05 lb1 list-box
line 7 col 44
size 24 lines 5
data-columns (1, 3, 5)
display-columns (1, 7, 15)
notify-selchange
event EVENT-LB1
to exclude some events
EVENT-LIST (cmd-Goto Msg-Init-Menu Msg-Menu-Input)
EXCLUDE-EVENT-LIST 1
.
05 label
line 8 col 71
title "Selected row:"
size 10
.
05 lb-list-row label
line 7.8 col 83
size 4 cells
css-base-style-name "alert alert-warning"
.
05 push-button
title "Export to Excel"
line 10 col 71
size 15
exception-value 501
.
05 label
title "Paged List-Box"
line 13 col 31
size 12 cells
.
05 lb2 list-box
line 13 col 44
size 24 lines 10
data-columns (1, 3)
display-columns(1, 7)
notify-selchange
paged
event EVENT-LB2
.
...
PROCEDURE DIVISION.
...
perform LB2-FIRST-PAGE-PAGED.
...
EVENT-LB1.
evaluate event-type
when ntf-selchange
modify lb-list-row title event-data-1
end-evaluate
.
EVENT-LB2.
evaluate event-type
when ntf-pl-next
perform NEXT-LB-ELEMENT
when ntf-pl-prev
perform PREV-LB-ELEMENT
when ntf-pl-nextpage
perform NEXT-PAGE-LB-ELEMENT
when ntf-pl-prevpage
perform PREV-PAGE-LB-ELEMENT
when ntf-pl-first
perform LB2-FIRST-PAGE-PAGED
when ntf-pl-last
perform LB2-LAST-PAGE-PAGED
end-evaluate.
LB2-FIRST-PAGE-PAGED.
modify lb2, mass-update = 1
set lb2-ff to true.
move zero to pagedIdxL
perform NEXT-LB-ELEMENT num-lines-lb times.
modify lb2, mass-update = zero.
LB2-LAST-PAGE-PAGED.
modify lb2, mass-update = 1
set lb2-rr to true.
compute pagedIdxL = max-paged-element + 1
perform prev-LB-ELEMENT num-lines-lb times.
modify lb2, mass-update = zero.
NEXT-LB-ELEMENT.
evaluate true
when lb2-ff
add 1 to pagedIdxL
when lb2-rr
compute pagedIdxL = pagedIdxL + num-lines-lb
end-evaluate.
set lb2-ff to true
if pagedIdxL > max-paged-element
set event-action to event-action-fail-terminate
move max-paged-element to pagedIdxL
end-if
if event-action not = event-action-fail-terminate
modify LB2 item-to-add rec-paged(pagedIdxL)
end-if.
PREV-LB-ELEMENT.
evaluate true
when lb2-ff
compute pagedIdxL = pagedIdxL - num-lines-lb
when lb2-rr
subtract 1 from pagedIdxL
end-evaluate.
set lb2-rr to true.
if pagedIdxL < 1
set event-action to event-action-fail-terminate
move 1 to pagedIdxL
end-if
if event-action not = event-action-fail-terminate
modify lb2 insertion-index 1
modify lb2 item-to-add rec-paged(pagedIdxL)
end-if.
NEXT-PAGE-LB-ELEMENT.
modify lb2, mass-update = 1
perform NEXT-LB-ELEMENT num-lines-lb times
modify lb2, mass-update = 0.
PREV-PAGE-LB-ELEMENT.
modify lb2, mass-update = 1
perform PREV-LB-ELEMENT num-lines-lb times
modify lb2, mass-update = 0.
EXPORT-LISTBOX-TO-EXCEL.
accept excel-position from environment "excel.prefix"
string excel-position delimited by trailing space
"/isCOBOLLISTBOX.xlsx" delimited by size
into excel-position
modify lb1 export-file-name excel-position
modify lb1 export-file-format = "xlxs".
modify lb1 action action-export.
accept excel-position from environment "excel.js.prefix"
string excel-position delimited by trailing space
"/isCOBOLLISTBOX.xlsx" delimited by size
into excel-position
call "WD2$REDIRECT" using excel-position, "_blank"
giving return-code.