Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Background colors on comboboxes inconsistent
Message
From
19/12/1999 09:56:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00305852
Message ID:
00305860
Views:
25
>I have a method that I wrote that sets the background color of all empty form fields to pale yellow. That way, at a glance, the user knows what fields remain to be filled. After the user fills the field its background color changes to white. The method is called Setbackcolor as seen below and runs whenever I do a form Init or change to another record by pressing Top, Bottom, Prev, Next. The problem is that if the RowSource is not Value, but is Array or Fields instead, the background color does not change to white. The background color changes to gray behind the characters only and stays pale yellow background in the rest of the form field. I apologize for the wrapped-around command lines below. I think you can still follow what I am doing.
>
>LOCAL loRef, ii
>loRef = THISFORM
>FOR ii = 1 TO loRef.ControlCount
> DO CASE
> CASE loRef.Controls(ii).BaseClass = "Textbox"
> loRef.Controls(ii).BackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> loRef.Controls(ii).DisabledBackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> CASE loRef.Controls(ii).BaseClass = "Editbox"
> loRef.Controls(ii).BackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> loRef.Controls(ii).DisabledBackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> CASE loRef.Controls(ii).BaseClass = "Combobox"
> loRef.Controls(ii).BackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> loRef.Controls(ii).DisabledBackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> CASE loRef.Controls(ii).BaseClass = "Checkbox"
> loRef.Controls(ii).BackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> loRef.Controls(ii).DisabledBackColor = ;
> IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
> ENDCASE
>NEXT
>
>Then inside of each form field I have the following code in the Interactive Change event. This code changes the background color from pale yellow to white whenever the user enters a value into the form field:
>
>THIS.BackColor = IIF(EMPTY(THIS.Value), ;
> RGB(255,255,128),RGB(255,255,255))
>THIS.DisabledBackColor = IIF(EMPTY(THIS.Value), ;
> RGB(255,255,128),RGB(255,255,255))
>
>How come Array and Fields-based comboboxes background colors behave differently than Value-based comboboxes? This does not compute! I don't see the problem. Do you? Please help. Thanks.


Steve,
I've never done this kind of stuff :) I would try using DisplayValue instead of value. Unless something is selected "value" property sounds to be empty (I didn't try at all just thinking).
But there is another point there. As soon as a control becomes an object of another container your method would bomb. Instead write code like :
iif(empty(this.value)...)
to refresh or access, assign of a custom property in your classes.
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