Consultor Eletrônico



Kbase P148250: Cannot change background color of all selected rows in a multiple-selection browse
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/07/2009
Status: Unverified

SYMPTOM(s):

Cannot change background color of all selected rows in a multiple-selection browse

When a several rows are selected by dragging a mouse, on mouse-up only the last row selected is colored.

FACT(s) (Environment):

Procedure sets a logical field on selected rows to indicate that they should be colored.
Logical field is set correctly on each row that should be colored, even though the color does not appear.
Single selected rows are colored correctly.
Browse is scrollable
Not all rows are visible at the same time
Windows
OpenEdge 10.1B

CAUSE:

Code was intended to loop through selected browse rows, fetch each one in turn using the FETCH-SELECTED-ROW() method of the browse handle, and apply color to each row field using the BGCOLOR attribute. This does not work because what is fetched by FETCH-SELECT-ROW is a record in the underlying table. BGCOLOR is an attribute of the browse, not the underlying table. When it is referenced, it is referenced for the current row in the browse. In the case of a multiple selection, this is the last row of the selection.

FIX:

Because this application includes a table field that indicates which records should appear as colored rows in the browse, the correct rows can be colored by using a combination of MOUSE-SELECT-UP, MOUSE-EXTEND-CLICK, and ROW-DISPLAY EVENTS, as follows:

Set the "colored" field of selected table rows in the MOUSE-SELECT-UP and MOUSE-EXTEND-CLICK triggers, depending on whether multiple rows are selected by dragging or by control-clicking.
Once the selected rows have been marked "colored", invoke the REFRESH() method of the browse handle to fire the ROW-DISPLAY event for the visible rows.
The ROW-DISPLAY event will fire each time a row comes into the viewport. The REFRESH method invoked in the MOUSE-SELECT-UP / MOUSE-EXTEND-CLICK triggers force it to be fired for the rows that were already in the viewport when they were selected.
In the ROW-DISPLAY trigger, set the BGCOLOR attribute of each column in the current browse row.