Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do i color code text boxes based on db?
Message
From
15/12/2001 08:08:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00594778
Message ID:
00594786
Views:
36
This message has been marked as a message which has helped to the initial question of the thread.
>I have a form which has about 30 text boxes which I want to color code. So for the "forecolor" property I want to simply say something like "f_color(this.value)" instead of defining a specific color. the function f_color would do some calculation and would return a color such as red.
>
>so thisform.text1.ForeColor= f_color(this.value) works well but i am getting a type error if the color returned is "50,50,50". if i do a VAL on the color as in thisform.text1.ForeColor= val(f_color(this.value)), it works but does not return the color i want. how, and in what format, do i return the correct color?
>
>thanks,
>
>Nancy

thisform.text1.ForeColor = eval('rgb('+fcolor(this.value)+')')

In your fcolor code you make to always return a numeric or rgb() series. It'd be easier. If you don't do that this would be longer but safer way :
lcColor = fcolor(this.Value)
lnColor = eval(iif(occurs(',',lcColor)=2,'rgb(','')+;
  lcColor+;
  iif(occurs(',',lcColor)=2,')',''))
thisform.text1.ForeColor = lnColor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform