var handle hwwin, hwfrm, hwbr, ht, hb, hq, hp.
var handle [2] hwcol.
function createRow logical private (
i_hb as handle,
i_ii as int,
i_cc as char
):
i_hb:buffer-create().
assign
i_hb::id = i_ii
i_hb::description = i_cc
.
end function.
create temp-table ht.
ht:add-new-field( 'id', 'int64' ).
ht:add-new-field( 'description', 'character' ).
ht:temp-table-prepare( 'dynamic' ).
hb = ht:default-buffer-handle.
createRow( hb, 1, 'one' ).
createRow( hb, 2, 'two' ).
createRow( hb, 3, 'three' ).
createRow( hb, 4, 'four' ).
create window hwwin assign
width = 100
height = 20
status-area = false
message-area = false
visible = true
.
create frame hwfrm assign
parent = hwwin
width = hwwin:width
height = hwwin:height
visible = true
.
create query hq.
hq:add-buffer( hb ).
hq:query-prepare( substitute( 'for each &1', hb:name ) ).
create browse hwbr assign
frame = hwfrm
query = hq
width = hwfrm:width - 1
height = hwfrm:height - 1
visible = true
sensitive = true
.
hwcol[1] = hwbr:add-like-column( hb:buffer-field( 'id' ) ).
hwcol[2] = hwbr:add-like-column( hb:buffer-field( 'description' ) ).
hp = this-procedure.
on row-display of hwbr persistent run RowTrigger in hp ( hwbr:query, hwcol ).
hq:query-open().
wait-for close of hwwin.
procedure RowTrigger:
define input parameter i_hq as handle no-undo.
define input parameter i_hwcol as handle no-undo extent.
var handle hb.
var int ix.
if valid-handle( i_hq ) then do:
hb = i_hq:get-buffer-handle(1).
if valid-handle( hb ) then do:
do ix = 1 to extent( i_hwcol ):
i_hwcol [ix]:bgcolor = 13 + ( hb::id modulo 2 ).
end.
end.
end.
end procedure.