We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Persisting column sizes

Thread ID:

Created:

Updated:

Platform:

Replies:

47934 Aug 16,2006 12:12 PM UTC Aug 18,2006 02:19 PM UTC WinForms 5
loading
Tags: GridControl
Bill Langlais
Asked On August 16, 2006 12:12 PM UTC

I am using a GridGroupingControl with 5 nested tables. I want to remember column sizes whenever they are changed and set them whenever the program is started.

Is using:

this.gridGroupingControl1.GetTableControl(TableName).Model.ColWidths[ColumnName] = saved width;

The best way to restore the widths?

Is using:

OnTableControlResizingColumns event of the GridGroupingControl

the best event to trap? Will this catch resizes across all 5 tables?

Would I use the MouseUp reason?

Thanks!

WJL




Administrator [Syncfusion]
Replied On August 16, 2006 05:30 PM UTC

I think you can just set properties in Form.Load (or wherever you initialize your groupinggrid). The properties you want to set would be TableDescriptor.Columns[colName].Width for all the tables and all the columns. So, instead of using the ColWidths collection (inherited from GridControlBase), use the Width properties on the GridColumnDescriptors for all the tables.

Another option you may want to consider is to use the built-in xml schema serialization support (it saves more than colwidths, but does save the widths). Take a look at this sample. \Syncfusion\Essential Studio\4.2.0.37\Windows\Grid.Grouping.Windows\Samples\CategoryView

Bill Langlais
Replied On August 17, 2006 03:32 AM UTC

I tried wrining the engine settings using the following:




void
Form1::SaveSkiResultsGrid(String *FileName)
{
XmlTextWriter *xw = new XmlTextWriter(S"SkiTrackGrid.XML", System::Text::Encoding::UTF8);
P_GridSkiResults->WriteXmlSchema(xw);
xw->Close();
}


I tried this in two places, one in a event handler for the GridSkiResultsSelectedRecordsChanged
(put here for testing convienience)

the other in the _tWinMain as follows:


Application::Run(MainWindow);
MainWindow->SaveSkiResultsGrid(S"BeforeExit.xml");


Included are the two resulting xml files. The onw in _tWinMain seems to have nothing of value in it and the other does not have any column widths even though I resized two colums

I wanted to use the _tWinMain since it would contain the last changes but that seems to not store anything.

WJL


XmlFiles.zip

Administrator [Syncfusion]
Replied On August 17, 2006 07:55 AM UTC

Try handling the Form.Closing event for the form that holds P_GridSkiResults grid and write out the XML there to see if that will save the column widths. It does for me in a simple sample using version 4.2.0.60. If that does not work, there must be something else going on. Place a stop where you try to write out the XML and look at the values for the TableDescriptor.Column[colIndex].Width to see if they are as expected.

Are you doing anything special with your GridGroupingControl, like deriving it and overriding various methods or using a custom grouping engine for some reason?

Bill Langlais
Replied On August 18, 2006 02:40 AM UTC

The Form Closing woked better then using WinMain. But the problem is that I have 5 nested tables and on the the changes to the top level table are written out. Is there a way to write out all five tables?

Administrator [Syncfusion]
Replied On August 18, 2006 02:19 PM UTC

Here is a sample where column sizes in nested tables are being persisted for me using 4.2.0.60.

http://www.syncfusion.com/Support/user/uploads/GGC_Nestedtables_964c9c29.zip

Are you doing something different?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;