set forecolor of a MS forms label

netfreaky

New Member
set forecolor of MS forms labels as handles

Hi,

i'm trying to make a program more flexible than we used to do.
One of the things i want is to change the forecolors of all labels and fields to black before doing the input checks.

We use MS Forms 2.0 Labels with OpenEdge 10.1A.
The normal code to change it is:
Code:
assign chCtrl<name>:<caption>:forecolor = intColor
All our label names start with CtrlLbl.


But when using handles, it doesn't recognize the caption (in my case, this always is "Label").

Does anyone has an idea to solve this?


The code to run through all objects is below:


Code:
DEFINE INPUT PARAMETER intColor AS INT NO-UNDO.
DEFINE VARIABLE grp AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE flw AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE strExclude AS CHARACTER NO-UNDO.
/* don't change colors of the following fields: */
ASSIGN strExclude = "txtGemaaktDoor,txtGewijzigdDoor,txtPersnr".
 
/* run through widgets in default-frame */
grp = FRAME default-frame:HANDLE:FIRST-CHILD.
do while grp <> ?:
    flw = grp:FIRST-CHILD.
    /* overlopen objecten van frame */
    DO WHILE flw <> ?:
        IF lookup(lc(flw:NAME),lc(strExclude)) = 0 THEN DO:
            IF lc(substr(flw:NAME,1,7)) EQ lc("ctrlLbl") THEN DO:
 
                /* TRY TO CHANGE THE LABEL FORECOLOR, BUT THIS WON'T WORK */
                flw:LABEL:forecolor = intColor.
 
            END.
            ELSE DO:
                CASE flw:TYPE:
                    WHEN "FILL-IN" THEN ASSIGN flw:FGCOLOR = intColor.
                    WHEN "COMBO-BOX" THEN ASSIGN flw:FGCOLOR = intColor.
                    WHEN "TOGGLE-BOX" THEN ASSIGN flw:FGCOLOR = intColor.
                    WHEN "TEXT" THEN ASSIGN flw:FGCOLOR = intColor.
                END CASE.
            END.
        END.
        flw = flw:NEXT-SIBLING.
    END.
    grp = grp:NEXT-SIBLING.
end.
Thanks in advance,

Netfreaky
 
Top