Results 1 to 7 of 7

Thread: Simulating dynamic row color changes in a grid.

  1. #1

    Simulating dynamic row color changes in a grid.

    Hi Forum,

    I need to give some rows in a grid different colors to make them stick out.

    If I am correct, Lianja has no standard methods to do this.

    The "gridformating" example is my starting point.

    Columns in grids have "Cell dynamic background" and "Cell dynamic foreground" methods.

    Unfortunately I have not been able to modify these on the fly or even look at the contents in the debugger.

    Can someone please help me out?

    TIA,
    Ernst
    Name:  li_celldyn.jpg
Views: 179
Size:  70.4 KB

  2. #2
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi Ernst,

    I believe in this case, the values should be BackColor and ForeColor.
    Take a look at this page to see if it might help.

    http://www.lianja.com/doc/index.php/Column

    If you edit cell colors, I believe the grid will need to be refreshed for those changes to appear.

    Cory
    Last edited by CGibson; 2015-08-06 at 08:17.

  3. #3
    Hi Cory,

    Thanks for your answer.

    The properties you refer to apply to the whole column and I can modify the column's header using them.

    I need to be able to change the colours of a particular row in a column, a so called 'item'.

    Anyway, I'll continue trying to find a solution.

  4. #4
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,839
    Hi Ernst,

    "Cell dynamic background" and "Cell dynamic foreground" are not currently supported on the Lianja Web Client.

    On the Desktop Client, they are not exposed as properties, but the attributes take an expression. This could be a comparison to a memory variable or other data or you can specify a Lianja/VFP UDF (user defined function) that returns the color, e.g. for a character column value:

    myfunc("{}")

    Your myfunc.prg or myfunc function in a library is passed the current cell value and can then do any processing or checks required before returning the color. Calling the section.refresh() will re-evaluate the expressions in the attributes.

    Regards,

    Yvonne

  5. #5
    Hi Yvonne,

    Thanks. This works fine for grids in sections with tables bound to them.

    The grid I want to manipulate sits on a canvas and is not tied to a table. Double clicking on a column header does not expose any properties and\or methods. I presume by design.

    Is there a work around that you could suggest?

    Regards,
    Ernst

  6. #6
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,839
    Hi Ernst,

    The Canvas Section grid/TreeGrid is based on the Tree class rather than the Grid Section and does not have "Cell dynamic background" and "Cell dynamic foreground".

    It does have the option of specifying an icon on the row - maybe this would work for you as an alternative?

    In the screenshot below, I've used the lianjacustomcanvas App and specified an icon at the start of the row in the Cart, changing the icon depending on the Cart item's total.

    Note: Desktop App

    Name:  canvas_grid.jpg
Views: 927
Size:  105.2 KB

    Regards,

    Yvonne

  7. #7
    Thank you Yvonne.

    This is a good alternative.

    Regards,
    Ernst

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us