>Thanks for the response, James. I have the feeling that I am missing something simple ... I'm running the following code from the command line:
>
>oForm = createobject("form")
>oForm.show()
>oForm.AddObject("lstTest","listbox")
>oForm.lstTest.visible = .T.
>oForm.lstTest.AddItem( "Hello (RED)" )
>oForm.lstTest.AddItem( "Hello (GREEN)" )
>oForm.lstTest.AddItem( "Hello (BLUE)" )
>
>The following command should change the second row to green:
>
>oForm.lstTest.ItemForeColor(2) = RGB(0,255,0)
>
>but it changes all rows. I have also tried using the following command to make sure that the default setting for RowSourceType is, in fact, present:
>
>oForm.lstTest.RowSourceType = 0
>
>This does not seem to have any effect. Any thoughts on what I'm am overlooking? This has to be simple, right?
John,
I do not believe .itemForeColor will permit a change to a single item's forecolor, but changes the forecolors of all items.
You evidently believe that ItemForeColor(2) = nSomeColor refers to the second item in the list. The documentation, sparse and confusing though it is, would not lead one to believe that individual list item forecolors can be changed in such a manner. In effect ItemForeColor(2)appears to change all the forecolor of all items to color 2 (whatever that is). In other words, these are equivalent statements:
.itemforecolor(2)
.itemforecolor = 2
To reset the forecolors of individual items, you will probably have to remove the item and add it back with a different color.
If there is another way, I am not aware of it.
regard,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.comNo trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.