Hello!
How can I after I apply preset to a grid see which preset was applied with preset manager ? I mean after I apply preset I cannot see which preset was applied anymore.
And another question is how can I enable "Ins" key on keyboard for adding new row to a grid ?
Thank you for your answers.
Gregor
Hi Gregor,
Some enumeration values in the grid have a "Default" option. Default just means that the property setting will be resolved to one of the other settings at run-time based on some other conditions."Default" in this sense means "Not Set". The grid, and in fact the whole WinForms suite of controls, uses this technique a lot in order to allow you to set properties on various levels of granularity.
For example, AllowColSizing on the Override. The Override object exists on the band and on the DisplayLayout. So if you set it on the Band, then the band setting is used for that individual band. If you do not set it on the band, then the band will use the DisplayLayout.Override setting. And if that's not set, the grid resolves to some intelligent default.
Yes I see. This answered my question. I thought it was like that.
I just want to ask you one more question.
When I see default value for properties in DisplayLayou this are default values from preset I've applied to a grid ? Or what does this default value mean ? Default value of what ?
Regards, Gregor
filejg said:How can I after I apply preset to a grid see which preset was applied with preset manager ? I mean after I apply preset I cannot see which preset was applied anymore.
A preset is just a collection of property settings on the grid. The preset file has a name and some extra info, but the grid does not store this information, so there's no way to tell at run-time which preset was applied to the grid.
You'll have to clarify what you mean by "preset" in this context.
To answer your second question, the following code sample demonstrates how to use the UltraGridBand's'AddNew' method to add a new row in response to the KeyDown event when the Insert key is pressed:
this.ultraGrid.DisplayLayout.Override.AllowAddNew = AllowAddNew.Yes;
void ultraGrid_KeyDown(object sender, KeyEventArgs e){ UltraGrid grid = sender as UltraGrid; if ( e.KeyData == Keys.Insert ) { UltraGridRow activeRow = grid.ActiveRow; if ( activeRow != null ) { UltraGridRow newRow = activeRow.Band.AddNew(); // Note that the Activate methods return false when they succeeded, // which is why we check for false here if ( newRow != null && newRow.Activate() == false && newRow.Cells.Count > 0 && newRow.Cells[0].Activate() == false ) grid.PerformAction(UltraGridAction.EnterEditMode); } }}