4 extern int __ecereVMethodID_class_OnFree;
7 public class FieldBox : DataBox
14 int64 dataHolder; // THERE SEEMS TO BE A BUG WHEN ACCESSING row ACROSS .so
24 if(editor.table == field.table)
25 result = editor.editRow;
26 else if(editor.lookups)
28 Lookup lookup = editor.lookups[field.table]; // Map<Table, Lookup> limits to single lookup per table
29 if(lookup.valueField && lookup.findField && lookup.row && !lookup.row.nil)
37 // DataBox has a member called editor as well?
38 // would like to rename TableEditor to TableControl anyway
39 public property TableEditor editor
46 editor.RemoveFieldBox(this);
49 value.AddFieldBox(this);
56 if(eClass_IsDerived(parent._class, class(TableEditor)))
57 property::editor = (TableEditor)parent;
62 if(eClass_IsDerived(master._class, class(TableEditor)))
63 property::editor = (TableEditor)master;
66 public property Field field
71 if(field) type = null;
75 ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder);
76 if(type.type == structClass)
78 void * dataPtr = (void *)dataHolder;
85 dataType = value ? value.type : null;
87 text = field ? field.name : null;
89 if(dataType && dataType.type == structClass)
91 dataHolder = (int64)new0 byte[dataType.structSize];
92 data = (void *)dataHolder;
94 else if(dataType && (dataType.type == noHeadClass || dataType.type == normalClass))
96 if(eClass_IsDerived(dataType, class(String)))
97 dataHolder = (int64)CopyString("");
99 dataHolder = (int64)eInstance_New(dataType);
100 data = (void *)&dataHolder;
107 if(!type) type = dataType;
116 SetData(null, false);
118 if(type && (type.type == noHeadClass || type.type == normalClass))
120 if(eClass_IsDerived(type, class(String)))
121 dataHolder = (int64)CopyString("");
123 dataHolder = (int64)eInstance_New(type);
124 data = (void *)&dataHolder;
137 //Id test = row.sysID;
138 SetData(null, false);
140 ((bool (*)())(void *)Row::GetData)(row, field, field.type, data);
142 if(!dataHolder && type && (type.type == noHeadClass || type.type == normalClass))
144 if(eClass_IsDerived(type, class(String)))
145 dataHolder = (int64)CopyString("");
147 dataHolder = (int64)eInstance_New(type);
148 data = (void *)&dataHolder;
162 Class type = field.type;
163 if(!DataBox::SaveData())
166 ((bool (*)())(void *)Row::SetData)(row, field, type,
167 (type.type == noHeadClass || type.type == normalClass) ? *(void **)data : data);
169 modifiedDocument = false;
175 if(visible && created)
179 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
183 if(modifiedDocument && !DataBox::SaveData())
189 bool OnKeyDown(Key key, unichar ch)
191 if((SmartKey)key == enter)
193 DataBox::OnKeyDown(key, ch);
197 return DataBox::OnKeyDown(key, ch);
200 bool OnKeyHit(Key key, unichar ch)
202 if((SmartKey)key == enter)
203 parent.CycleChildren(true, false, false, true);
205 return DataBox::OnKeyHit(key, ch);
208 bool Window::NotifyChanged(bool closingDropDown)
210 // This gets called on the master and is unaware of the change being user input or internally set
211 modifiedDocument = true;
215 bool Window::NotifyModified()
217 // This gets called on the master and is unaware of the change being user input or internally set
218 modifiedDocument = true;
225 SetData(null, false);
229 ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder);
230 if(type.type == structClass)
232 void * dataPtr = (void *)dataHolder;