Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » [Bug] ArrayCtrl::Serialize
[Bug] ArrayCtrl::Serialize [message #27512] Wed, 21 July 2010 15:28 Go to next message
Shire is currently offline  Shire
Messages: 41
Registered: September 2006
Location: Russia, Yamal peninsula
Member
Bug appears when control contains column with child editing controls factory, like method ArrayCtrl::Ctrls<>.
GUI_APP_MAIN
{
  TopWindow w;
  ArrayCtrl ac;

  w.AddChild(&ac);
  ac.HSizePosZ().VSizePosZ();

  ac.AddColumn("1");
  ac.AddColumn("2").Ctrls<Option>();
  ac.Add("one",true);
  ac.Add("two",false);
  
  StringStream ss;
  ss.SetStoring();
  ac.Serialize(ss);
  ac.Remove(0); // row count changed,
  // and count of child controls changed too

  ss.Seek(0);
  ss.SetLoading();
  ss.LoadThrowing();
  try {
    ac.Serialize(ss);
  } catch(LoadingError) {
    PromptOK("Exception caught!");
  }
}

When number of visible rows differs between storing and loading, Ctrl::Serialize throws exception. Root of evil is in child control enumeration loop:
void   Ctrl::Serialize(Stream& s)
{
...
	for(Ctrl *q = GetFirstChild(); q; q = q->GetNext())
		q->Serialize(s);
}

Such serialization does not support dynamic count of child controls. This bug may appear in other places.
Re: [Bug] ArrayCtrl::Serialize [message #27560 is a reply to message #27512] Fri, 23 July 2010 11:27 Go to previous message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Thanks. It looks like ArrayCtrl::Serialize should be overriden to be empty, right? (Fixed it this way for now).

Mirek
Previous Topic: ArrayCtrl and converters
Next Topic: DropGrid and Background Colors
Goto Forum:
  


Current Time: Tue Nov 19 19:27:39 CET 2019

Total time taken to generate the page: 0.02310 seconds