Changing Field colors
Changing Field colors
What is the syntax used to change the color of a border of a combo box if nothing has been entered in the field to red at runtime?
-
Joerg Hamacher
- Posts: 120
- Joined: Thu Feb 11, 2016 12:01 am
Re: Changing Field colors
You can handle this wih styles and events like this (web page):
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_VS.Style) Name(#Style1) Borderbottom(1) Borderbrush(#Brush1) Borderleft(1) Borderright(1) Bordertop(1)
Define_Com Class(#PRIM_VS.SolidBrush) Name(#Brush1) Color(Red)
Define_Com Class(#STD_TEXT.EditField) Name(#STD_TEXT) Displayposition(1) Left(142) Parent(#COM_OWNER) Tabposition(1) Top(100)
Define_Com Class(#STD_TEXTS.EditField) Name(#STD_TEXTS) Displayposition(2) Left(147) Parent(#COM_OWNER) Tabposition(2) Top(243)
Evtroutine Handling(#Com_owner.Initialize)
Endroutine
Evtroutine Handling(#STD_TEXT.Changed #STD_TEXT.LostFocus)
If (#STD_TEXT = *Blanks)
#STD_TEXT.Style <= #Style1
Else
#STD_TEXT.Style <= *NULL
Endif
Endroutine
End_Com
Best regards,
Jörg
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_VS.Style) Name(#Style1) Borderbottom(1) Borderbrush(#Brush1) Borderleft(1) Borderright(1) Bordertop(1)
Define_Com Class(#PRIM_VS.SolidBrush) Name(#Brush1) Color(Red)
Define_Com Class(#STD_TEXT.EditField) Name(#STD_TEXT) Displayposition(1) Left(142) Parent(#COM_OWNER) Tabposition(1) Top(100)
Define_Com Class(#STD_TEXTS.EditField) Name(#STD_TEXTS) Displayposition(2) Left(147) Parent(#COM_OWNER) Tabposition(2) Top(243)
Evtroutine Handling(#Com_owner.Initialize)
Endroutine
Evtroutine Handling(#STD_TEXT.Changed #STD_TEXT.LostFocus)
If (#STD_TEXT = *Blanks)
#STD_TEXT.Style <= #Style1
Else
#STD_TEXT.Style <= *NULL
Endif
Endroutine
End_Com
Best regards,
Jörg
Re: Changing Field colors
Tested it out now and works like a charm!! Thanks for the assistance Jörg.