Results 1 to 6 of 6

Thread: cWebTreeView setting colour of an item - red / green / normal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Edmonton Canada
    Posts
    834

    Default cWebTreeView setting colour of an item - red / green / normal

    I have a cWebTreeView that for some items, as part of the name that is displayed as the tree item, is the text OK or ERROR.
    For the ones that contain the text OK I would like to display the tree item using the colour Green
    For the ones that contain the text ERROR I would like to display the tree time using the colour Red.

    The colour of the tree item would be either Red, Green or normal

    Does anyone have an idea how I would go about doing that?

    Thanks
    Archie

  2. #2
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    3,585

    Default Re: cWebTreeView setting colour of an item - red / green / normal

    you can set this prop to true
    https://docs.dataaccess.com/dataflex...iew&rhsyns=%20

    and use inlined style in your itens when loading them
    Samuel Pizarro

  3. #3
    Join Date
    Mar 2009
    Location
    Edmonton Canada
    Posts
    834

    Default Re: cWebTreeView setting colour of an item - red / green / normal

    For future reference this worked:
    Set pbAllowHtml to True // in cWebTreeView object

    Move "The tree item description" to sDisplayName
    If (bOk) Move ('<span style="color:green;"> ' + sDisplayName + '</span>') to sDisplayName
    If (bHasErrors) Move ('<span style="color:red;"> ' + sDisplayName + '</span>') to sDisplayName

    Send AddChildTreeItem (&aItems) sId sParentId sDisplayName sValue True True bExpanded sToolTip "" ""

    Again, thanks Samuel!

  4. #4
    Join Date
    Mar 2009
    Location
    Edmonton Canada
    Posts
    834

    Default Re: cWebTreeView setting colour of an item - red / green / normal

    Thanks Samuel!!

  5. #5
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,044

    Default Re: cWebTreeView setting colour of an item - red / green / normal

    Archie

    How are you loading the tree view? In OnLoadChildNodes, yoiu can do something like (untested):
    Code:
    If (somethingOK) ;
        Move "someGreenCSSClass" to aItems[i].sCSSClass
    Else If (somethingERROR) ;
        Move "someRedCSSClass" to aItens[i].sCSSClass
    Mike

  6. #6
    Join Date
    Mar 2009
    Location
    Edmonton Canada
    Posts
    834

    Default Re: cWebTreeView setting colour of an item - red / green / normal

    Hi Mike
    Thanks for the reply.
    I did note that in the documentation they suggested that inline html is not as good as using CSS.
    Arhcie

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •