Can you make list entries different colours? 
Author Message
 Can you make list entries different colours?

This is my function"

function Add2List(sListname, sText, sValue)
    dim zOption : Set zOption=Document.CreateElement ("OPTION")

    zOption.Text=sText
    if sValue="" then zOption.Value=sText else zOption.Value=sValue

    sListname.Add zOption
end function

sListname is the name of the list box, ie frmMain.lstCustomers
sText is the list display text ie "John Smith"
sValue is the value returned from a frmMain.lstCustomers.value ie
"John_Smith"

I use this function to add small numbers of entries to a list box and it
works well.

I would like to be able to set the colour of each entry, or at least the
font weight.

This doesn't work:

function Add2List(sListname, sText, sValue, bBold)     ' highlight test
    dim zOption : Set zOption=Document.CreateElement ("OPTION")

    zOption.Text=sText
    if sValue="" then zOption.Value=sText else zOption.Value=sValue
    if bBold then zOption.style.fontweight="bold"

    sListname.Add zOption
end function

any ideas?

cj



Fri, 12 Sep 2003 09:42:19 GMT  
 Can you make list entries different colours?
I got it!

function Add2List(sListname, sText, sValue, bActive)
    dim zOption : Set zOption=Document.CreateElement ("OPTION")

    zOption.Text=sText
    if sValue="" then zOption.Value=sText else zOption.Value=sValue

    if bActive then zOption.style.color="black" else
zOption.style.color="gray"

    sListname.Add zOption
end function

cj

Quote:

> This is my function"

> function Add2List(sListname, sText, sValue)
>     dim zOption : Set zOption=Document.CreateElement ("OPTION")

>     zOption.Text=sText
>     if sValue="" then zOption.Value=sText else zOption.Value=sValue

>     sListname.Add zOption
> end function

> sListname is the name of the list box, ie frmMain.lstCustomers
> sText is the list display text ie "John Smith"
> sValue is the value returned from a frmMain.lstCustomers.value ie
> "John_Smith"

> I use this function to add small numbers of entries to a list box and it
> works well.

> I would like to be able to set the colour of each entry, or at least the
> font weight.

> This doesn't work:

> function Add2List(sListname, sText, sValue, bBold)     ' highlight test
>     dim zOption : Set zOption=Document.CreateElement ("OPTION")

>     zOption.Text=sText
>     if sValue="" then zOption.Value=sText else zOption.Value=sValue
>     if bBold then zOption.style.fontweight="bold"

>     sListname.Add zOption
> end function

> any ideas?

> cj



Fri, 12 Sep 2003 10:06:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to show list entries in different colours?

2. define different font for different items in the same HTML list box

3. Creating one database entry from different pieces

4. Acrobat 3 makes different PS?

5. Adding an entry to the Add Remove Programs list

6. Macro to highlight certain words in different colours

7. DBGrid: different colours for diferent columns??

8. Different colours/fonts in a text box?

9. Is it possible to have the lines in a listbox be different colours

10. Showing Different Colours in a ListView Control?

11. Showing Different Colours in a ListView Control?

12. Forms and title bars with different colours

 

 
Powered by phpBB® Forum Software