Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #13459

Re: SingleLineEdit ReadOnly color & textcolor

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Karl-Heinz" <invalid@invalid.invalid>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: SingleLineEdit ReadOnly color & textcolor
Date Tue, 19 Oct 2021 16:11:00 +0200
Lines 86
Message-ID <it827iFsoukU1@mid.individual.net> (permalink)
References <bbbe7dec-72da-4da1-80d0-7314fc19b3f8n@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="UTF-8"; reply-type=original
Content-Transfer-Encoding 8bit
X-Trace individual.net t158Rij9/U7I/4gDZSwlygTLXrsX41xjeKapNFFVsNQjlP1Rg=
Cancel-Lock sha1:xNn2NLIjsQnsUCluNkUCpvh5+uo=
In-Reply-To <bbbe7dec-72da-4da1-80d0-7314fc19b3f8n@googlegroups.com>
X-Priority 3
X-MSMail-Priority Normal
Importance Normal
X-Newsreader Microsoft Windows Live Mail 16.4.3564.1216
X-MimeOLE Produced By Microsoft MimeOLE V16.4.3564.1216
Xref csiph.com comp.lang.clipper.visual-objects:13459

Show key headers only | View raw


Hi Gregory,

[...]
In certain circumstances I wanted to change color of text in SLE
[...]

With the modified Readonly assign and the modified Enable()/Disable()
methods below you can set the colors and brushes you like. If you use the
code unchanged and Readonly is set to true or Disable() is called, the
Textcolor will be green. All other background and text colors use the
windows default colors.


CLASS MySle INHERIT SingleLineEdit

ASSIGN ReadOnly(lNewValue) CLASS MySle

    SUPER:ReadOnly := lNewValue

    IF SELF:ValidateControl()

        IF lNewValue
            SELF:Background := Brush { Color { GetSysColor (
COLOR_BTNFACE ) } }
            SELF:TextColor := Color { COLORGREEN}

            // This would set the default Textcolor when Readonly is set to
true
//            SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) }

        ELSE
            SELF:Background := Brush { Color { GetSysColor (
COLOR_WINDOW ) } }
            SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) }
        ENDIF

    ENDIF

    RETURN lNewValue


METHOD Enable() CLASS MySle

    //  no need to call SUPER:Enable()

    IF SELF:ValidateControl()

        SELF:Setstyle ( WS_DISABLED , FALSE )

        SELF:Background := Brush { Color { GetSysColor ( COLOR_WINDOW ) } }
        SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) }

    ENDIF


    RETURN SELF


METHOD Disable() CLASS MySle

    //  don´t call SUPER:Disable(), because afterwards you can´t change the
colors !


    IF SELF:ValidateControl()

        SELF:Setstyle ( WS_DISABLED , TRUE )

        SELF:Background := Brush { Color { GetSysColor ( COLOR_BTNFACE ) } }
        SELF:TextColor := Color { COLORGREEN }

        // This would set the default disabled Textcolor
//        SELF:TextColor := Color { GetSysColor ( COLOR_GRAYTEXT ) }

    ENDIF


    RETURN SELF


btw. implement a global system where the required colors and brushes are
created only once.

regards
Karl-Heinz

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

SingleLineEdit ReadOnly color & textcolor "Grzegorz R." <ramotny64@gmail.com> - 2021-10-16 04:14 -0700
  Re: SingleLineEdit ReadOnly color & textcolor "Karl-Heinz" <invalid@invalid.invalid> - 2021-10-19 16:11 +0200
    Re: SingleLineEdit ReadOnly color & textcolor "Grzegorz R." <ramotny64@gmail.com> - 2021-11-15 06:55 -0800

csiph-web