Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #13455 > unrolled thread
| Started by | "Grzegorz R." <ramotny64@gmail.com> |
|---|---|
| First post | 2021-10-16 04:14 -0700 |
| Last post | 2021-11-15 06:55 -0800 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
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
| From | "Grzegorz R." <ramotny64@gmail.com> |
|---|---|
| Date | 2021-10-16 04:14 -0700 |
| Subject | SingleLineEdit ReadOnly color & textcolor |
| Message-ID | <bbbe7dec-72da-4da1-80d0-7314fc19b3f8n@googlegroups.com> |
Hello all..
In certain circumstances I wanted to change color of text in SLE using:
SELF:oDCsle:TextColor := Color{COLORRED}
However if the SLE gets READONLY:=TRUE the background gets white instead of default (gray).
How can I change/set foreground text color without affecting background independently of ReadOnly/Enable state or ...
how can I find and remember respective background (and foreground) colors for Normal, ReadOnly and Disabled states?
Regards
Gregory
[toc] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2021-10-19 16:11 +0200 |
| Message-ID | <it827iFsoukU1@mid.individual.net> |
| In reply to | #13455 |
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
[toc] | [prev] | [next] | [standalone]
| From | "Grzegorz R." <ramotny64@gmail.com> |
|---|---|
| Date | 2021-11-15 06:55 -0800 |
| Message-ID | <56440566-c75d-49ce-93b4-4302a92c676fn@googlegroups.com> |
| In reply to | #13459 |
wtorek, 19 października 2021 o 16:15:16 UTC+2 Karl-Heinz napisał(a):
> 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
Hello Karl
thank You - it works fine.
Gregory
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web