Hey,
I would like to know if there is one event which recognize all layoutchanges on my ultragrid? The task is that I have an ultraGrid with a layout which I can save and load. The problem is that if someone closes the application, the done changes are lost without saving (save is just manual and should continue to be manual).
So it would be great if one event is fired up by changing the layout and the close-application event can request this (maybe boolean) variable and inform/ask the user about saving the changes on the grid.
Thanks and regards
I have just enabled all the events that I thought appropriate for possible visual changes and set a property flag LayoutDirty. Would be nice if there was something better.
Nick
Hi,
Most application simply always save the layout. Why would the user not want to save it?
If you really want to determine if something has changed, it's probably possible, but not easy.
One approach you might take is to save the initial layout of the grid before the user has a chance to make any changes. You could store the layout in a MemoryStream.
Then when the application closes, you could save the layout to another MemoryStream and then loop through the streams one byte at a time and compare to see if there have been any changes.
I haven't tried this, but it should be possible to do, in theory. I can't vouch for how efficient it is, though.
ok...
Saving the layout is optional. I also use the save-method. But I want to ask the user before closing the form, if he wants to save the layout. If there are no changes on the layout, the question for saving is not necessary. It's like in Word or Excel when you open a file and you make no changes then you can save the file without a question for saving the changes - when you make no changes then there is also no question....
it's like: "You changed the layout! Save changes?" - Yes, No, Cancel
I hope the question was now correctly asked ;)
Greetings
Maybe I missed something but I'm not following why you can't call the UltraGridLayout.Save or UltraGridLayout.SaveAsXml method in response to the FormClosing event, after prompting the user.