| Subject |
Re: font color in entryfield |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Sat, 25 Jul 2020 14:10:45 +0530 |
| Newsgroups |
dbase.getting-started |
On 25.07.2020 13:40, charlie wrote:
> Is it pssible n a form to have a color font or background in an entryfield. I see bold or ita;ic font properties for example in entryfields but other than on focus I don't see how to do this.
>
> I want to do something like this:
>
> if a + b # entryfieldx
> entryfieldafont = red
> endif
>
> Is there a way of doing this?
>
> Thanks for any help.
>
Good Afternoon Charlie,
Use the onChange event to achieve this
A Entryfield which changes color whenever it is changed
this.MCOMPANY = new MUN_ENTRYFIELD(this)
with (this.MCOMPANY)
onLostFocus = class::MCOMPANY_ONLOSTFOCUS
onChange = {;this.colornormal = "red"}
height = 1.0909
left = 112.0
top = 3.0
width = 15.0
value = "COMPANY"
validRequired = false
validErrorMsg = "This field can never be blank"
maxLength = 10
pageno = 0
endwith
And then else where in the form where I want it to revert to normal
form.mcompany.colornormal = form.mcompany.def_col
I have avoided hard coding of default color by adding property to custom
class. So whatever be the default color that I set here will be
retained. I will not be required to go change every form when I change
default colours.
class mun_ENTRYFIELD(parentObj) of ENTRYFIELD(parentObj) custom
with (this)
onGotFocus = class::ENTRYFIELD_ONGOTFOCUS
onLostFocus = class::ENTRYFIELD_ONLOSTFOCUS
height = 1.5
left = 11.0
top = 7.5
selectAll = true
width = 22.0
metric = 0 // Chars
value = "Entryfield1"
endwith
this.def_col = this.colornormal
function ENTRYFIELD_onGotFocus()
//this.keyboard( "{Home}" )
on key label uparrow up_arrow()
return
function ENTRYFIELD_onLostFocus()
on key label uparrow
return
endclass
This is just for example your onChange event will be different.
Regards
Akshat
|
|