Good afternoon to everyone. I was wondering if anyone has ever tried to change the color of a label for prompt based on whether the field is populated in the record or not? The data fields for the WINDOWS table would also be a good reference guide to have, since, I suspect a pre-process subroutine will have to change the WINDOWS record for this record and then redisplay the window and all of its attributes. So, if anyone knows where I can get a copy of the WINDOWS table data fields that would be great. LD WINDOWS only displays the symbolics and data field 1.
Thanks
Daniel
WC_W%(PromptNo) is the video display attribute.
WC_W% requires Window_Common%, and you can use the VA mnemonic, instead of 9, if you $Insert LCPositions.
If you change the attribute, you will want to:
WC_DISPLAY_ACTION%=REDISPLAY.HIGHLIGHTS$
Where REDISPLAY.HIGHLIGHTS$ is defined in WINDOW.CONSTANTS.
We have a window where we routinely do this on PostReads and on changes to paired fields.
HTH,
Hello Daniel:
If you have the "Advanced Revelation developer Series Window Common Reference" manual, that will help you a great deal. It sounds like you want to use the WC_W% window common variable. It holds the prompt and label and everything else connected to the screen. It exists only for the duration the screen is active and can be manipulated far beyond just changing colors so you need to be carful.I've included some snippets of code below that deal with changing the color and prompt value entry type (required or protected). I realize that you asked for information on labels. The same sort of thing can be done to a stand alone label and/or to a label connected to a prompt. Instead of using the VA$ ~ entry area's video attribute (color), you probably want to use the DA$ ~ display label's video attribute (color).The WC_W% and WC_SI% dynamic arrays are discribed in the Windows Common Manual starting on page 38.Since the format is WC_W%(prompt number), you need to be careful of the prompt number. You can hard code it but if in the furture one or more prompts are added to or deleted from the window and come before the prompt number they you'll have to reset that number to its new number. Otherwise a completely different prompt will be changing colors. So, if there is any way to use a variable, that might be a good idea.I hope at least some of this may help.Michael Slack
*
* NOTES:
* FIELD COLOR - SHOULD BE DEFINED IN THE FOLLOWING FORMAT:
* "C":BACKGROUND:FOREGROUND
*
* EXAMPLE:][color=C4]' *LIGHT-YELLOW ON DARK-RED
*
* COLOR DEFINITIONS:
* BLACK =0 DARK-GRAY =8
* DARK-BLUE =1 LIGHT-BLUE =9
* DARK-GREEN =2 LIGHT-GREEN =:
* DARK_CYAN =3 LIGHT-CYAN =;
* DARK_RED =4 LIGHT-RED =
* LIGHT-GRAY =7 WHITE =?
*
* SEE TECHNICAL BULLETIN #4 FOR MORE INFORMATION
*
* THE WINDOW_COMMON% IS THE MOST IMPORTANT OF THE THREE TO HAVE IN A
* PROGRAM THAT WILL MANIPULATE A WINDOW.
$INSERT SYSINCLUDE, WINDOW_COMMON%
$INSERT SYSINCLUDE, WINDOW.CONSTANTS
$INSERT SYSINCLUDE, MT_LCPOSITIONS
*
POST_SAVE_SET_PROMPTS_DATE_MTR_RDG:
*
* LOOP THRU ALL OF THE PROMPTS IN THE CURRENT WINDOW AND FIND THE
* ONES THAT HAVE THE DICTIONARY NUMBERS OF "DATE_MTR1_RDG" AND
* "DATE_MTR2_RDG". WHEN THOSE ARE FOUND, SET THIER ENTRY TYPE AND
* PROMPT COLOR TO THE DEFAULT SETTINGS. IF THIS ISN'T DONE THEN
* WHATEVER THE LAST ENTRY TYPE AND COLOR SETTINGS WERE ON THOSE
* PROMPTS WILL BE THERE FOR THE NEXT ROW PROCESSED WHEN SEVERAL ARE
* DONE AT ONE TIME. THIS IS JUST A WAY TO KEEP THINGS NEAT AND
* CONSISTANT.
*
* THIS COMPARES THE PROMPT'S DICTIONARY FIELD NUMBER TO AN EQUATED
* VARIABLE THAT CONTAINS THE DICTIONARY FIELD NUMBER THAT I'M LOOKING
* FOR. WHEN A MATCH IS FOUND, THE PROMPT IS MANIPULATED.
FOR I=1 TO WC_W_CNT%
IF (WC_W%(I)=WO_DATE_MTR1_RDG$) OR (WC_W%(I)=WO_DATE_MTR2_RDG$) THENWC_W%(I)=CHAR(27):'C31' ;* PROMPT COLOR: DARK-BLUE ON DARK-CYANWC_W%(I)=P' ;* ENTRY TYPE: P=PROTECTEDENDNEXT I
WC_DISPLAY_ACTION%=REDISPLAY.PROMPTS$
WC_RESET% =RESET.EDIT$
RETURN
*
* THIS IS FROM A PIECE OD CODE THAT IS CHANGING THE PROMPT COLOR AND
* SETTING IT TO PROTECTED. WE SET THE PROMPT COLOR DEPENDING ON IF
* IT'S A REQUIRED, PROTECTED OR OPTIONAL PROMPT.
WC_W%(1) =CHAR(27):'C31' ;*PROMPT COLOR: CYAN ON LIGHT-BLUE
WC_W%(1)=P' ;*ENTRY TYPE: P=PROTECTED
WC_RESET% =3 ;* 3 IS RESET_EDIT$
*
* WC_WI% HOLDS THE CURRENT PROMPT NUMBER THAT THE CURSOR IS ON.
* THIS CHECKS TO SEE IF THE CURRENT PROMPT IS SET TO PROTECTED OR NOT.
* YOU CAN DO OTHER THINGS LIKE THIS WITH THIS SORT OF METHOD.
IF WC_W%(WC_WI%)=P' THEN
WC_IS%='END
*
* HERE ARE JUST A FEW EXAMPLES OF SETTING A PROMPT COLOR.
WC_W%(11) =CHAR(27):'C4?' ;* PROMPT COLOR: WHITE ON RED
WC_W%(11) =CHAR(27):'C31' ;* PROMPT COLOR: DARK BLUE ON LIGHT-BLUE
WC_W%(26) =CHAR(27):'C4?' ;* PROMPT COLOR: BLACK ON LIGHT-GREY
WC_W%(WC_WI% + 1)=CHAR(27): 'C;;' ;* CHANGES COLOR TO LIGHT BLUE
*
* NOTICE THAT THE LEFT ARROW IS THE SAME AS A CHAR(27).
WC_W%(SCN_TIME_TO_ACCOUNTING) =C3?' ;* SET TIME_TO_ACCOUNTING COLORS TO LIGHT-BLUE
WC_W%(SCN_CRAFT_CODE) =C1?' ;* CHANGE THE CRAFT_CODES COLOR TO BLUE
WC_DISPLAY_ACTION%=5 ;* REFRESH SCREEN WITH NEW VALUES
*