How to color row in browse?

grinder

Member
Hi,

my problem is, that I want to color one specific row in a browse.
The browse is based on a temp-table.

In the ROW-DISPLAY-Trigger I use the following code:

Code:
  DEFINE VARIABLE h AS HANDLE NO-UNDO.
 
  mnBGColor = IF tUms.tSort = 0 THEN 14 ELSE ?.
  h = BROWSE-Ums:HANDLE.
  ASSIGN
    h:BGCOLOR = mnBGColor
  /**/.

But this code colors the whole browse.

How can i get the handle on a single row (criteria for this row is tUms.tSort = 0)?

Or I am completely wrong with this way?

THX in advance
Phil
 
Hi

The way that I did it was to do each 'cell' in the row individually, though there may be a better way.

ie in ROW-DISPLAY of the browser (Browse-2)

ASSIGN
book.isbn13:bgcolor IN BROWSE browse-2 = 12
book.shorttitle:bgcolor IN BROWSE browse-2 = 12
book.series:bgcolor IN BROWSE browse-2 = 12
etc.

HTH
Mike
 

grinder

Member
Hi Mike,

I also tired it your way, but then i get the error:
Code:
Could not find <element-name> in frame <frame>. (3567)
And if I try to reference it with the frame-phrase I get the same error :(
 

doreynie

Member
You may not refer to it as it was in a frame, you should refer to it with the option "in browse" as Mike explains.

According to me, that's the only way to color a whole row in a browse.
 
Hi,

My Browse uses a freeform query with each 'field' defined in the DISPLAY trigger of the Browser - see below


/* Connected Databases
imprint PROGRESS
*/
&Scoped-define WINDOW-NAME wfndbook
/*------------------------------------------------------------------------
File:
Description: from cntnrwin.w - ADM SmartWindow Template
Input Parameters:
<none>
Output Parameters:
<none>
History: New V9 Version - January 15, 1998

------------------------------------------------------------------------*/
/* This .W file was created with the Progress AB. */
/*----------------------------------------------------------------------*/
/* Create an unnamed pool to store all the widgets created
by this procedure. This is a good default which assures
that this procedure's triggers and internal procedures
will execute in this procedure's storage, and that proper
cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
/* *************************** Definitions ************************** */
/* Parameters Definitions --- */
/* Local Variable Definitions --- */
DEF VARIABLE fbookcode LIKE book.bookcode NO-UNDO.
DEF VAR xast AS CHAR FORMAT "x(3)" NO-UNDO.

/* ******************** Preprocessor Definitions ******************** */
&Scoped-define PROCEDURE-TYPE SmartWindow
&Scoped-define DB-AWARE no
&Scoped-define ADM-CONTAINER WINDOW
&Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source
/* Name of first Frame and/or Browse and/or first Query */
&Scoped-define FRAME-NAME fMain
&Scoped-define BROWSE-NAME BROWSE-2
/* Internal Tables (found by Frame, Query & Browse Queries) */
&Scoped-define INTERNAL-TABLES book
/* Definitions for BROWSE BROWSE-2 */
&Scoped-define FIELDS-IN-QUERY-BROWSE-2 xast book.isbn13 book.shorttitle
&Scoped-define ENABLED-FIELDS-IN-QUERY-BROWSE-2
&Scoped-define SELF-NAME BROWSE-2
&Scoped-define QUERY-STRING-BROWSE-2 FOR EACH book NO-LOCK BY book.bookcode INDEXED-REPOSITION
&Scoped-define OPEN-QUERY-BROWSE-2 OPEN QUERY {&SELF-NAME} FOR EACH book NO-LOCK BY book.bookcode INDEXED-REPOSITION.
&Scoped-define TABLES-IN-QUERY-BROWSE-2 book
&Scoped-define FIRST-TABLE-IN-QUERY-BROWSE-2 book

/* Definitions for FRAME fMain */
&Scoped-define OPEN-BROWSERS-IN-QUERY-fMain ~
~{&OPEN-QUERY-BROWSE-2}
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS BROWSE-2
/* Custom List Definitions */
/* List-1,List-2,List-3,List-4,List-5,List-6 */
/* *********************** Control Definitions ********************** */
/* Define the widget handle for the window */
DEFINE VAR wfndbook AS WIDGET-HANDLE NO-UNDO.
/* Definitions of the field level widgets */
/* Query definitions */
DEFINE QUERY BROWSE-2 FOR
book SCROLLING.
/* Browse definitions */
DEFINE BROWSE BROWSE-2
QUERY BROWSE-2 NO-LOCK DISPLAY
xast COLUMN-LABEL "Stock"
book.isbn13 FORMAT "x(16)" COLUMN-LABEL "ISBN13"
book.shorttitle FORMAT "x(36)":U
WITH NO-ROW-MARKERS SEPARATORS SIZE 142 BY 19.52
BGCOLOR 11 FGCOLOR 0 ROW-HEIGHT-CHARS .57 EXPANDABLE.

/* ************************ Frame Definitions *********************** */
DEFINE FRAME fMain
BROWSE-2 AT ROW 1.48 COL 1
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 142.8 BY 20.29.

/* *********************** Procedure Settings ************************ */
/* Settings for THIS-PROCEDURE
Type: SmartWindow
Allow: Basic,Browse,DB-Fields,Query,Smart,Window
Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source
Other Settings: COMPILE
*/
/* ************************* Create Window ************************** */
IF SESSION:DISPLAY-TYPE = "GUI":U THEN
CREATE WINDOW wfndbook ASSIGN
HIDDEN = YES
TITLE = "Find Book"
HEIGHT = 20.29
WIDTH = 142.8
MAX-HEIGHT = 28.81
MAX-WIDTH = 160
VIRTUAL-HEIGHT = 28.81
VIRTUAL-WIDTH = 160
RESIZE = no
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.
ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
/* END WINDOW DEFINITION */
/* ************************* Included-Libraries *********************** */
{src/adm2/containr.i}


/* *********** Runtime Attributes and AppBuilder Settings *********** */
/* SETTINGS FOR WINDOW wfndbook
VISIBLE,,RUN-PERSISTENT */
/* SETTINGS FOR FRAME fMain
*/
/* BROWSE-TAB BROWSE-2 1 fMain */
ASSIGN
BROWSE-2:MAX-DATA-GUESS IN FRAME fMain = 70000
BROWSE-2:ALLOW-COLUMN-SEARCHING IN FRAME fMain = TRUE
BROWSE-2:COLUMN-RESIZABLE IN FRAME fMain = TRUE
BROWSE-2:SEPARATOR-FGCOLOR IN FRAME fMain = 1.
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wfndbook)
THEN wfndbook:HIDDEN = yes.

/* Setting information for Queries and Browse Widgets fields */
/* Query rebuild information for BROWSE BROWSE-2
_START_FREEFORM
OPEN QUERY {&SELF-NAME} FOR EACH book
NO-LOCK BY book.bookcode INDEXED-REPOSITION.
_END_FREEFORM
_Options = "NO-LOCK INDEXED-REPOSITION"
_Where[1] = "book.bookcode BEGINS lv-initval
OR book.longtitle[1] CONTAINS lv-initval
OR book.longtitle[2] CONTAINS lv-initval
OR book.isbn CONTAINS lv-initval


"
_Query is OPENED
*/ /* BROWSE BROWSE-2 */


/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME wfndbook
ON END-ERROR OF wfndbook /* Find Book */
OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc" key.
In a persistently run window, just ignore this. If we did not, the
application would exit. */
IF THIS-PROCEDURE:pERSISTENT THEN RETURN NO-APPLY.
END.

ON WINDOW-CLOSE OF wfndbook /* Find Book */
DO:
/* This ADM code must be left here in order for the SmartWindow
and its descendents to terminate properly on exit. */
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN NO-APPLY.
END.

&Scoped-define BROWSE-NAME BROWSE-2
&Scoped-define SELF-NAME BROWSE-2
ON ROW-DISPLAY OF BROWSE-2 IN FRAME fMain
DO:

IF book.shorttitle BEGINS "F" THEN
ASSIGN xast = "Yes"
xast:bgcolor IN BROWSE browse-2 = 12
xast:fGCOLOR IN BROWSE browse-2 = 15
book.isbn13:bgcolor IN BROWSE browse-2 = 12
book.shorttitle:bgcolor IN BROWSE browse-2 = 12.

END.

&UNDEFINE SELF-NAME

/* *************************** Main Block *************************** */
/* Include custom Main Block code for SmartWindows. */
{src/adm2/windowmn.i}

/* ********************** Internal Procedures *********************** */
PROCEDURE adm-create-objects :
/*------------------------------------------------------------------------------
Purpose: Create handles for all SmartObjects used in this procedure.
After SmartObjects are initialized, then SmartLinks are added.
Parameters: <none>
------------------------------------------------------------------------------*/
END PROCEDURE.
PROCEDURE disable_UI :
/*------------------------------------------------------------------------------
Purpose: DISABLE the User Interface
Parameters: <none>
Notes: Here we clean-up the user-interface by deleting
dynamic widgets we have created and/or hide
frames. This procedure is usually called when
we are ready to "clean-up" after running.
------------------------------------------------------------------------------*/
/* Delete the WINDOW we created */
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wfndbook)
THEN DELETE WIDGET wfndbook.
IF THIS-PROCEDURE:pERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
END PROCEDURE.
PROCEDURE enable_UI :
/*------------------------------------------------------------------------------
Purpose: ENABLE the User Interface
Parameters: <none>
Notes: Here we display/view/enable the widgets in the
user-interface. In addition, OPEN all queries
associated with each FRAME and BROWSE.
These statements here are based on the "Other
Settings" section of the widget Property Sheets.
------------------------------------------------------------------------------*/
ENABLE BROWSE-2
WITH FRAME fMain IN WINDOW wfndbook.
{&OPEN-BROWSERS-IN-QUERY-fMain}
VIEW wfndbook.
END PROCEDURE.
PROCEDURE exitObject :
/*------------------------------------------------------------------------------
Purpose: Window-specific override of this procedure which destroys
its contents and itself.
Notes:
------------------------------------------------------------------------------*/
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN.
END PROCEDURE.
 
Top