change cell color in a dynamic browse

psuter

New Member
Does anybody know how to change the backgroundcolor of a dynamic browser?

In the Trigger "row-display" I tried to assign the bgcolor attribute on a field-handle, but it doesn't exist?

Thanks, Pascal
 
This is my first thought.

The trigger needs to be dynamic for a dynamic widget.

create browse {&BROWSE-HANDLE}
assign
parent = frame {&FRAME-NAME}:first-child
/* field group */
........... [etc. for other assigns]
font = 4
triggers:
on menu-drop persistent
run updateRowColor in this-procedure.
end triggers.


Procedure updateRowColor needs to find the handle of the column you want to change (e.g. BROWSE:FIRST-COLUMN then BROWSE:NEXT-COLUMN until all column handles have been processed).

Don't know if this will assign the color for the whole column; hopefully not :)
 

psuter

New Member
Dear Jon

There are a fiew things to add. First of all, I'm using a static browser with a freeform Query. The browser behaves as it were a dynamic browser.

I run a dynamic Query that is assigned to the browser. All fields of the Query are automatically displayed.

So, in fact, I can overwrite the Trigger "row-display". But unfortunately, I cannot set the bgcolor of a cell, because the fields are not directly accessible as it would be in a static browser not using freeform query:

assign table.field:bgcolor = 12.

I hope you can imagine my problem now. Is there a solution?

Thanks Pascal:confused:
 
I think this should still work because it reference the browse columns (which should be the same as the fields in it).

However, it can't be done inside a row-display trigger.


/* DEFINITIONS */
DEFINE TEMP-TABLE ttField
FIELD hHandle AS HANDLE
FIELD cField AS CHARACTER.

/* Before Open Query e.g. procedure initialiseBrowse */
DEF VAR hTemp AS HANDLE.

hTemp = BROWSE {&BROWSE-NAME}:FIRST-COLUMN.

ALL-COLUMNS:
REPEAT:

CREATE ttField.
ASSIGN
ttField.cField = hTemp:NAME
ttField.hHandle = hTemp.

IF VALID-HANDLE(hTemp:NEXT-COLUMN) THEN
hTemp = hTemp:NEXT-COLUMN.

ELSE LEAVE ALL-COLUMNS.

END.


/* Row display */
IF "user clause" THEN
DO:

FOR EACH ttField
WHERE LOOKUP("FIELD-LIST", cField) > 0
:

ttField.hHandle:BGCOLOR = 12.

END.

END.


Hope this helps


Regards

Jon


P.S. Don't know exactly what you're doing but using the FreeForm query builder does not create a dynamic query just a free form query (i.e. not restricted by the appBuilder's query programs).

A dynamic query is created using the CREATE QUERY statement (and other statements).
 

psuter

New Member
Dear Jon

It really worked that way! Thank you very much. I know that I confused you. But, as I've said, I'm using a static browser with a freeform query. This means that I assign a dynamic query handle while runtime to the static browser (browse-widget:QUERY = hMyQuery). This is my definition of "dynamic" within a static browser. Therefore, I cannot write "table.field:BGCOLOR = 12" in the "ROW-DISPLAY" Trigger because I have only buffer-field-handles. But with your help using a static browser with temp-table and changing the cell color, I could manage it at the end!

Thanks, Pascal
 
Top