browse row background color

rumi

Member
hi guys, is possible to set a background color of a row in browse? in function - 36.20.13 - i make a new browse - and i would like to set a background color - for example when is some filed TRUE .... is it possible?

thanks
 

mrobles

Member
Hi

With this code, you change the color each 2 records.
Put it in the main-block.
It suposes your browse is called browse-1

DEF VAR celda_br AS WIDGET-HANDLE EXTENT 15 NO-UNDO.
DEF VAR cual_celda AS WIDGET-HANDLE NO-UNDO.
DEF VAR n_cols_browse AS INT NO-UNDO.
DEF VAR col_act AS INT NO-UNDO.
DEF VAR t_col_br AS INT NO-UNDO INITIAL 11.
DEF VAR vg_col_eti_b AS INT NO-UNDO INITIAL 28.
ON ROW-DISPLAY OF browse-1
DO:
IF CURRENT-RESULT-ROW("browse-1") / 2 <> INT (CURRENT-RESULT-ROW("browse-1") / 2) THEN RETURN.
DO col_act = 1 TO n_cols_browse.
cual_celda = celda_br[col_act].
cual_celda:BGCOLOR = t_col_br.
END.
END.
DO n_cols_browse = 1 TO browse-1:NUM-COLUMNS.
celda_br[n_cols_browse] = browse-1:GET-BROWSE-COLUMN(n_cols_browse).
cual_celda = celda_br[n_cols_browse].
IF vg_col_eti_b <> 0 THEN cual_celda:LABEL-BGCOLOR = vg_col_eti_b.
IF n_cols_browse = 15 THEN LEAVE.
END.
n_cols_browse = browse-1:NUM-COLUMNS.
IF n_cols_browse > 15 THEN n_cols_browse = 15.



If you need one color for a specific value of a field, then change the trigger ON ROW-DISPLAY OF browse-1
remove the line IF CURRENT-RESULT-ROW("browse-1") / 2 <> INT (CURRENT-RESULT-ROW("browse-1") / 2) THEN RETURN.

and put something like this:
IF table.field = 'XYZ' THEN

MRobles
 

rumi

Member
thanks, but where is a source of browse? i make iin 36.20.13 new browse - add a tables to designer surface, set a connection between (keys) and i save it ... i dont write a code when i make a new browse
 
when you save it the *br*.p is created in start-in folder. Add the bits for the color , compile it move the code toMFG/PRO install folder. Hang it off a menu or field.

Robles that code of users will be great use to forum users..
 
Top