Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a better way to show my true colors in a combob
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00453959
Message ID:
00453977
Views:
24
>I populated a combobox on a form with 7 rows of differing bands of colors in the drop-down list for color coding purposes and my code to populate the combobox drop-down list is as follows:
>
>
>WITH THISFORM.cboBroselow
>	.AddItem("",.ListCount+1)
>	.PICTURE(1) = "\arrest\red.bmp"
>	.AddItem("",.ListCount+1)
>	.PICTURE(2) = "\arrest\purple.bmp"
>	.AddItem("",.ListCount+1)
>	.PICTURE(3) = "\arrest\yellow.bmp"
>	.AddItem("",.ListCount+1)
>	.PICTURE(4) = "\arrest\white.bmp"
>	.AddItem("",.ListCount+1)
>	.PICTURE(5) = "\arrest\blue.bmp"
>	.AddItem("",.ListCount+1)
>	.PICTURE(6) = "\arrest\orange.bmp"
>	.AddItem("",.ListCount+1)
>	.PICTURE(7) = "\arrest\green.bmp"
>ENDWITH
>
>
>I am looking for a way to show the chosen item's color that matches the .bmp in the combobox displayvalue window. Right now I am doing the YELLOW color band as follows in the Interactive change event of the comobox I have the following code (I would being doing something similar for ListIndex 1 thru 7 for all 7 differing color bands):
>
>
>IF THIS.ListIndex = 3
>	THIS.BackColor = RGB(255,255,0)
>	THIS.DisabledBackColor = RGB(255,255,0)
>ENDIF
>
>

Add a 2nd hidden column with the color value for each e.g.
WITH THISFORM.cboBroselow
	.AddItem("",.ListCount+1)
	.PICTURE(1) = "\arrest\red.bmp"
        .AddListItem("RGB(255,0,0)", .NewItemID, 2)
     etc., etc.....
Then in the Interactive Change
With this
    .BackColor = Eval(.List(.ListIndex,2)))
EndWith
Note:
Insanity: Doing the same thing over and over and expecting different results.
Previous
Reply
Map
View

Click here to load this message in the networking platform