F102 - Failure Feedback Forum
When getting a view from a new (unattached) row, it seems to loose it's connection with the row. If this is not a bug, it does at least seem counterintuitive and is different behaviour from when you get a view from an attached row.
The following code shows the problem:
#include "mk4.h"
#include <iostream>
using namespace std;
void main() {
c4_ViewProp pView("view");
c4_IntProp pInt("int");
// Create a row containing an int (for comparison)
// and a single view
c4_Row r;
c4_IntRef i1 = pInt(r);
c4_View v1 = pView(r);
// Set the int and add a row to the view
i1 = 99;
v1.Add(pInt[99]);
int value1 = pInt(v1[0]);
cout << "v1: int=" << (int)i1 << " rows=" << v1.GetSize() << " value=" << value1 << endl;
// Try to retrieve the int in the view through the original row
c4_View v2 = pView(r);
int value2 = pInt(v2[0]);
cout << "v2: int=" << (int)i1 << " rows=" << v2.GetSize() << " value=" << value2 << endl;
}
On my system it gives the following output:
v1: int=99 rows=1 value=99 v2: int=99 rows=0 value=0
Attached vs. unattached view issues are due to flaws in the design of Metakit. These cannot easily be fixed.
Imported
Copied from metakit cvstrac ticket #8
There are some substantial problems due to Metakit's attached/unattached dichotomy. These issues run deep, and would require a complete architectural overhaul of Metakit. This is not planned, since Vlerq is intended to supercede Metakit one day.