U++ framework
Do not panic. Ask here before giving up.

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: Tue Apr 28 06:57:18 GMT+2 2026

Total time taken to generate the page: 0.00488 seconds