Disable alternate row coloring for DevEx Grids

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #37974
    HeDiBo
    Participant

    Normally I'm thrilled by the nice alternate row coloring that TcxGrid will show.

    But I have two instances, where the alternate coloring makes the grid confusing. That's when the grid contains only a very few lines.

    How can I disable the alternate row coloring for these particular cxGrids?

    #58498
    Support
    Keymaster

    Hello!

    This behavior is not depended from AlphaControls. You should check the cxGrid documentation.

    AlphaControls engine just gives a color when cxGrid requires it.

    #58502
    HeDiBo
    Participant
    'Support' wrote:

    Hello!

    This behavior is not depended from AlphaControls. You should check the cxGrid documentation.

    AlphaControls engine just gives a color when cxGrid requires it.

    The coloring of rows in a TcxGrid is done by assigning the Styles.ContentEven and Styles.ContentOdd properties of the TcxGridDBTableView control.

    In the style repository, you can set the color to a fixed value, or to clDefault. The first will produce the same color, irrespective of the used skin, the latter produces the same alternating color as before.

    There may be a color value that I don't know about, that's interpreted differently by AC. If that's the case, which fixed color value could I assign, that would produce a single skin color coordinated row color?

    For instance, I tried clWindow, but that produced a white row color in dark skins also.

    #58517
    Support
    Keymaster

    Sorry, I don't understand something, seems…

    If you do not want to have different colored lines, why you are touching these Styles.ContentEven and Styles.ContentOdd properties?

    #58518
    HeDiBo
    Participant
    'Support' wrote:

    Sorry, I don't understand something, seems…

    If you do not want to have different colored lines, why you are touching these Styles.ContentEven and Styles.ContentOdd properties?

    If you don't use these styles, the grid has alternate coloring.

    If you want equal coloring you have to set ContentEven and ContentOdd to the same color.

    #58519
    Support
    Keymaster

    Maybe you can just disable odd/even coloring by changing the Styles.UseOddEvenStyles property to False?

    #58520
    HeDiBo
    Participant
    'Support' wrote:

    Maybe you can just disable odd/even coloring by changing the Styles.UseOddEvenStyles property to False?

    There's no such property.

    #58521
    HeDiBo
    Participant
    'HeDiBo' wrote:

    There's no such property.

    At least not in my version of DevEx (11.2.9)

    #58569
    Support
    Keymaster

    I haven't idea how to change it, unfortunately.

    AlphaControls just gives a color there when color is requested. And can't affect to logic.

    #58570
    HeDiBo
    Participant
    'Support' wrote:

    I haven't idea how to change it, unfortunately.

    AlphaControls just gives a color there when color is requested. And can't affect to logic.

    It could be done by specifying a very special color in the Styles.ContentEven and Styles.ContentOdd properties of the TcxGridDBTableView.

    AC would have to interpret that special value as the EDIT color or any similar color that would work also for dark skins.

    #58573
    Support
    Keymaster

    We haven't access to the control or his properties.

    DevExpress skin engine calls a function where requests a color and we can return a color only:

    Code:
    function TcxACLookAndFeelPainter.DefaultContentEvenColor: TColor;
    begin
    if Skinned then
    Result := DefaultManager.Palette[pcEditBG_EvenRow]
    else
    Result := inherited DefaultContentEvenColor;
    end;
    #58577
    HeDiBo
    Participant
    'Support' wrote:

    We haven't access to the control or his properties.

    DevExpress skin engine calls a function where requests a color and we can return a color only:

    Code:
    function TcxACLookAndFeelPainter.DefaultContentEvenColor: TColor;
    begin
    if Skinned then
    Result := DefaultManager.Palette[pcEditBG_EvenRow]
    else
    Result := inherited DefaultContentEvenColor;
    end;

    You might do something like this:

    Code:
    function TcxACLookAndFeelPainter.DefaultContentEvenColor: TColor;
    begin
    Result := inherited DefaultContentEvenColor;
    if Skinned then begin
    if Result =
    then Result := DefaultManager.Palette[pcEditBG_OddRow]
    else Result := DefaultManager.Palette[pcEditBG_EvenRow];
    end;
    end;
    #58661
    HeDiBo
    Participant

    In AC 14.07 you test the color on clDefault OR clWindow.

    If ContentOdd and ContentEven are both set to the style with the clWindow color, this is the result:

    [attachment=9010:cxGridColor.jpg]

    The left grid has made this change, the right hand one stays away from the styles logic.

    If I change the style color to clDefault, all's well again, but the rows show alternating colors again.

    #58677
    Support
    Keymaster

    Yes, I see, this way doesn't work.

    Result of “inherited DefaultContentEvenColor” not clWindow and not clDefault, so condition is False always.

    I have another idea, try the attached file. But this solution works only if clDefault specified in Style.

    With clWindow it doesn't work.

    #58704
    HeDiBo
    Participant
    'Support' wrote:

    Yes, I see, this way doesn't work.

    Result of “inherited DefaultContentEvenColor” not clWindow and not clDefault, so condition is False always.

    I have another idea, try the attached file. But this solution works only if clDefault specified in Style.

    With clWindow it doesn't work.

    Thanks for your effort, but that changes coloring in all grids, not just in the grid where the style was defined.

    #58750
    HeDiBo
    Participant

    It's totally unusable now (AC 14.11)

    None of the grids show alternating colors, no matter whether style is specified or not!!

    Just return it to what it was. I found another way by using a TsListView in that particular case.

    You can simplify this:

    Code:
    function TcxACLookAndFeelPainter.DefaultContentEvenColor: TColor;
    begin
    if Skinned then
    Result := DefaultManager.Palette[pcEditBG_EvenRow]
    else
    Result := inherited DefaultContentEvenColor;
    end;

    function TcxACLookAndFeelPainter.DefaultContentOddColor: TColor;
    begin
    if Skinned then
    Result := DefaultManager.Palette[pcEditBG_OddRow]
    else
    Result := inherited DefaultContentOddColor;
    end;

    To this:

    Code:
    function TcxACLookAndFeelPainter.DefaultContentEvenColor: TColor;
    begin
    Result := DefaultManager.Palette[pcEditBG_EvenRow]
    end;

    function TcxACLookAndFeelPainter.DefaultContentOddColor: TColor;
    begin
    Result := DefaultManager.Palette[pcEditBG_OddRow]
    end;

    because the functions are not called if skinned false

    #58844
    HeDiBo
    Participant

    It's still totally wrong in AC 14.12

    Please change the code to

    Code:
    function TcxACLookAndFeelPainter.DefaultContentEvenColor: TColor;
    begin
    Result := DefaultManager.Palette[pcEditBG_EvenRow]
    end;

    function TcxACLookAndFeelPainter.DefaultContentOddColor: TColor;
    begin
    Result := DefaultManager.Palette[pcEditBG_OddRow]
    end;

    #58840
    Support
    Keymaster

    Ok, it will be reverted back in the nearest release.

Viewing 18 posts - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.