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 previous 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.
 
Read Message
Read Message
Previous Topic: ArrayCtrl and converters
Next Topic: DropGrid and Background Colors
Goto Forum:
  


Current Time: Fri Mar 29 06:11:17 CET 2024

Total time taken to generate the page: 0.01424 seconds