Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » [Bug] ArrayCtrl::Serialize
[Bug] ArrayCtrl::Serialize [message #27512] |
Wed, 21 July 2010 15:28 |
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.
|
|
|
|
Goto Forum:
Current Time: Fri Apr 26 00:37:33 CEST 2024
Total time taken to generate the page: 0.02887 seconds
|