bgcolor for a fill-in field

cecsystems.net

New Member
I'd like to be able to dynamically change the bgcolor and fgcolor of a fill-in widget on a gui screen based on the value of the field. I have tried a number of things with no luck getting the field to actually change color?

I am running dlc 9.1d in a syteline environment. If anyone has knowledge/code of how to accomplish this seemingly simple task, I would be greatful.

Chas C.
 
Hi Chas,

Can you not assign the 'entry' trigger to the fill-in to have some thingf like

IF fill-in-1:SCREEN-VALUE = "1" THEN ASSIGN fill-in-1:BGCOLOR = 12.

regards
Mike
 
Hi Chas,

please find below a piece of code that may help.
(Version 9.1e)

Mike

&Scoped-define WINDOW-NAME wWin
/*------------------------------------------------------------------------
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 --- */

/* ******************** 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
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS FILL-IN-1
&Scoped-Define DISPLAYED-OBJECTS FILL-IN-1
/* 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 wWin AS WIDGET-HANDLE NO-UNDO.
/* Definitions of the field level widgets */
DEFINE VARIABLE FILL-IN-1 AS CHARACTER FORMAT "X(256)":U
LABEL "Fill 1"
VIEW-AS FILL-IN
SIZE 14 BY 1 NO-UNDO.

/* ************************ Frame Definitions *********************** */
DEFINE FRAME fMain
FILL-IN-1 AT ROW 3.69 COL 14 COLON-ALIGNED
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 80 BY 17.

/* *********************** 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
*/
/* ************************* Create Window ************************** */
IF SESSION:DISPLAY-TYPE = "GUI":U THEN
CREATE WINDOW wWin ASSIGN
HIDDEN = YES
TITLE = "<insert SmartWindow title>"
HEIGHT = 17
WIDTH = 80
MAX-HEIGHT = 28.81
MAX-WIDTH = 146.14
VIRTUAL-HEIGHT = 28.81
VIRTUAL-WIDTH = 146.14
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 */
/* SmartWindow,ab,49271
Destroy on next read */
/* ************************* Included-Libraries *********************** */
{src/adm2/containr.i}


/* *********** Runtime Attributes and AppBuilder Settings *********** */
/* SETTINGS FOR WINDOW wWin
VISIBLE,,RUN-PERSISTENT */
/* SETTINGS FOR FRAME fMain
*/
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin)
THEN wWin:HIDDEN = yes.



/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME wWin
ON END-ERROR OF wWin /* <insert SmartWindow title> */
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 wWin /* <insert SmartWindow title> */
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 SELF-NAME FILL-IN-1
ON ENTRY OF FILL-IN-1 IN FRAME fMain /* Fill 1 */
DO:
MESSAGE "in entry of fill-in-1" VIEW-AS ALERT-BOX.
ASSIGN fill-in-1:BGCOLOR = 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(wWin)
THEN DELETE WIDGET wWin.
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.
------------------------------------------------------------------------------*/
DISPLAY FILL-IN-1
WITH FRAME fMain IN WINDOW wWin.
ENABLE FILL-IN-1
WITH FRAME fMain IN WINDOW wWin.
{&OPEN-BROWSERS-IN-QUERY-fMain}
VIEW wWin.
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.
 
Back
Top