How to change dcolor of cell in browse widget - CHUI

kjmacon

New Member
I'm running version 9.1e on a linux box. I am new to browse widgets and would like to know if anyone can please provide a sample of how to change the cell dcolor in the browse. Thanks.
 

rzr

Member
Does below for you ?

Code:
ON "ROW-DISPLAY" OF BROWSE Brw IN FRAME Fr_Main:
DO:
ASSIGN FieldInBrowse:DCOLOR IN BROWSE Brw = 15.
END.
 

kjmacon

New Member
Thanks! I will try this. The field in this case is an extent, so I think I should be able to find out what element of the extent by using the column number.
 

kjmacon

New Member
The columns are composed of a character variable with 50 extents. When I reference an element of the extent, I get this message:

"Widget array-element requires constant subscript." The code is:

ON ROW-DISPLAY of BROWSE item-browse
DO:
ASSIGN vmatrix.sz[icounter]:dcolor in browse item-browse = 4.
END.
 

4GLNewbie

Member
I think if you put a number (a constant) at the iCounter place, it works.. it wants a fixed value if i remember correctly.

I think you should do it another way.. or so i have seen something like that done.

Here it is how i did it also the same.. don't know if there's another way but this one works fine.

1. First saving handles of the columns on initialization (for example).
2. Then on row display estabilishing if the column handle is the one you're looking for from name. And then doing the assign of the color or what you want.

In code below i have loaded a celda_br1 (an array) all handles needed when opening the frame

Code:
DO n_cols_browse1 = 1 TO browse-1:NUM-COLUMNS:
    celda_br1[n_cols_browse1] = browse-1:GET-BROWSE-COLUMN(n_cols_browse1).
END.
n_cols_browse1 = browse-1:NUM-COLUMNS.

Then i do this to change all columns bg color, but i think you can do your stuff easily

Code:
ON row-display OF browse-1 IN FRAME z DO:
    DEF VAR col_act AS INTE NO-UNDO.
    DEF VAR cual_celda AS WIDGET-HANDLE NO-UNDO.
    IF [condition] THEN DO:
        DO col_act = 1 TO n_cols_browse1:
            cual_celda = celda_br1[col_act].
            cual_celda:BGCOLOR = g_c_w_bg.
        END.
    END.
END.
 
Top