Profile Picture

PaletteInheritance property on NDataGridView

Posted By Brad Swearingen 12 Years Ago
Author
Message
Brad Swearingen
Posted 12 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

1) I dropped a NDataGridView on my NForm.  When I set the PaletteInheritance value to None it still picks up the current scheme.  I set the scheme, for instance, like this:

NUIManager.Palette.Scheme = ColorScheme.Rosemary;

If I set the PaletteInheritance to None on an NButton on the same form it doesn't use the scheme.  Is there a way to make this work on an NDataGridView?

Specifically, I was investigating why the NDataGridViews column header text forecolor was not the same color as my NButton forecolor text is.  How can I make these be the same?

2) I noticed when using the ColorSheme.Blue and ColorScheme.Longhorn that a disabled NTextBox can not be read at all.  None of the other schemes and skins have this issue.  Seems the foreground color and the background color are the same with those schemes.  Is there a way to use those schemes and make the NTextBox readable?

I'm using the 11.12.14.12 build.



Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: 9 hours ago
Posts: 3,043, Visits: 3,777

Hello Brad,

If you set PaletteInheritance of NDataGridView to None it should prevent NUIManager to apply the colors of its Palette property on it. It should be displayed with its default colors.

To enable the fore color of the header of NDataGridView control to be determined by the Palette applied on it, you should set EnableHeadersVisualStyles to false.

 

You are right about your second notification.

We should change the color of the text when NTextBox control is disabled for these palettes.



Best Regards,
Nevron Support Team



Brad Swearingen
Posted 12 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

Thanks, using the EnableHeadersValueStyle(false) helps in some cases.  Glad to know about that.

As I indicated, setting PaletteInheritance.None on an NDataGridView does not work on the latest build.  The Palette is still inherited.  When setting on an NButton similarly the Palette is NOT inherited which is as expected.  Seems this is a bug in the NDataGridView widget.

Is there any way I can work around the problem mentioned in the Blue and Longhorn scheme on disabled textboxes?  How can I change my code today to work around this issue? 



Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: 9 hours ago
Posts: 3,043, Visits: 3,777
Hello Brad,

Regarding PaletteInheritance.None on NDataGridView, can you check whether you set this property to None after the palette from NUIManager is set.
If not its Palette property will already be set to the value from NUIManager.
If this not the case could you send us an example which shows the problem?

Regarding disabled NTextBox, fore and back colors of this control are transformed to gray scale when the control is disabled.
What you can do is to set PaletteInheritance to None AFTER the global palette is set so the control will receive this palette but it will be able to change it afterwords.
Then you should attach to EnabledChanged event and in the event handler check whether the control is disabled, and if so set its NTextBox.Palette.Window color to some lighter color. If the control is enabled return the default color from the global palette.

NUIManager.Palette.Scheme = ColorScheme.Blue;
nTextBox1.PaletteInheritance = PaletteInheritance.None;
nTextBox1.Palette.Scheme = ColorScheme.Blue;

...

void nTextBox1_EnabledChanged(object sender, System.EventArgs e)
{
   if (nTextBox1.Enabled)
   {
      nTextBox1.Palette.Window = NUIManager.Palette.Window;
   }
   else
   {
      nTextBox1.Palette.Window = Color.WhiteSmoke;
   }
}



Best Regards,
Nevron Support Team



Brad Swearingen
Posted 12 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

1) Yes, I'm creating the NForm with both the NButton and NDataGridView's PaletteInheritance.None set AFTER I've already assigned the NUIManager.Palette.Scheme (in this case to ColorScheme.Rosmary).  The NButton does not inherit the palette but the NDataGridView does.  Sounds like you expect this but if so it seems odd that one widget inherits and the other doesn't.

2) Thanks for the tip for the disabled NTextBox on the Blue scheme.  I was able to get that to work after also adding a NUIManager.GlobalPaletteChange event so I can keep the scheme correct should it change there after.  The key was making sure I set the Palette.Window back to the NUIManager.Palette.Window before subsequently setting it to Color.WhiteSmoke otherwise the Color.WhiteSmoke setting wouldn't take.  Seemed odd but glad that seems to work.  I used some code like the following on a NTextBox subclass during creation, EnableChanged and GlobalPaletteChange:

Palette.Scheme = NUIManager.Palette.Scheme;

if (!Enabled)

{

if ((Palette.Scheme == ColorScheme.Blue) || (Palette.Scheme == ColorScheme.Longhorn))

{

Palette.Window = NUIManager.Palette.Window;

Palette.Window = Color.WhiteSmoke;

}

}

else

{

Palette.Window = NUIManager.Palette.Window;

}





Similar Topics


Reading This Topic