extern int __ecereVMethodID_class_OnGetString;
private:
-char * defaultNameField = "Name";
-char * defaultIdField = "Id";
-char * defaultActiveField = "Active";
+const char * defaultNameField = "Name";
+const char * defaultIdField = "Id";
+const char * defaultActiveField = "Active";
-public void SetDefaultIdField(char * value) { defaultIdField = value; }
-public void SetDefaultNameField(char * value) { defaultNameField = value; }
+public void SetDefaultIdField(const char * value) { defaultIdField = value; }
+public void SetDefaultNameField(const char * value) { defaultNameField = value; }
public class ButtonStyle : Button
{
{
Window OnEdit(DataBox dataBox, DataBox obsolete, int x, int y, int w, int h, void * userData)
{
- Button button = dataBox.keepEditor ? (Button)obsolete : null;
+ Button button = dataBox.keepEditor ? (Button)dataBox.editor : null;
if(!button)
{
button = Button
bool DataBox::NotifyClicked(Button control, int x, int y, Modifiers mods)
{
bool checked = control.checked;
- SetData(&checked, false);
+ if(readOnly)
+ control.checked = !checked;
+ else
+ SetData(&checked, false);
return true;
}
};
Class type = nameField.type;
int64 data = 0;
if(type.type == structClass)
- data = (int64)new0 byte[type.structSize];
- ((bool (*)())(void *)r.GetData)(r, nameField, type, (type.type == structClass) ? (void *)data : &data);
- s = CopyString(((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)data, tempString, null, null));
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data);
+ data = (int64)(intptr)new0 byte[type.structSize];
+ ((bool (*)())(void *)r.GetData)(r, nameField, type, (type.type == structClass) ? (void *)(intptr)data : &data);
+ if(type.type == systemClass || type.type == enumClass || type.type == bitClass)
+ s = CopyString(((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &data, tempString, null, null));
+ else
+ s = CopyString(((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)(intptr)data, tempString, null, null));
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)(intptr)data);
if(type.type == structClass)
{
- void * _data = (void *)data;
+ void * _data = (void *)(intptr)data;
delete _data;
}
}
borderStyle = deep;
public:
- uint filter;
+ Id filter;
bool filtered;
Field nameField;
- uint exclusion;
+ Id exclusion;
Table table;
Field filterField;
- property uint filter
+ property Id filter
{
set
{
get { return filter; }
}
property Field nameField { set { nameField = value; } }
- property uint exclusion { set { exclusion = value; } }
+ property Id exclusion { set { exclusion = value; } }
property Table table { set { table = value; if(!nameField && value) nameField = value.FindField(defaultNameField); } }
virtual void Refill()
{
FieldIndex indexedFields[1];
// Table tbl = table.db.OpenTable(table.name, { tableRows });
- char * name = table.name;
+ const char * name = table.name;
Database db = table.db;
Table tbl = db.OpenTable(name, { tableRows });
if(tbl)
void EditNotifyUpdate(EditBox editBox)
{
DataRow row;
- char * contents = editBox.contents;
+ const char * contents = editBox.contents;
int len = strlen(contents);
if(len && editBox.charPos == len)
{
{
for(row = firstRow; row; row = row.next)
{
- char * string = row.string;
+ const char * string = row.string;
if(string && SearchString(string, 0, contents, false, false) == string)
{
// SelectRow(row);
public:
- property uint filter { set { filtered = true; filter = value; } get { return filter; } }
+ property Id filter { set { filtered = true; filter = value; } get { return filter; } }
property bool filtered { set { filtered = value; } }
- property uint exclusion { set { exclusion = value; } }
+ property Id exclusion { set { exclusion = value; } }
property Field filterField { set { filterField = value; } }
property Field nameField { set { nameField = value; } }
virtual void TableDropBox::RefillFunction();
if(editor)
{
TableDropBox dropBox = (TableDropBox) editor;
- uint id = data ? *(uint *)data : MAXDWORD;
+ Id id = data ? *(Id *)data : MAXDWORD;
void * notifyChanged = (void *)NotifyChanged;
OnConfigure(dropBox);
private:
Field nameField;
Field filterField;
- uint exclusion;
- uint filter;
+ Id exclusion;
+ Id filter;
bool filtered;
bool showNone;
}
anchor = { left = 110, right = shadowS + sgs * 2 };
borderStyle = deep;
+ // TOCHECK: Testing this for GenericEditor performance issue?
+ keepEditor = true;
+
public:
property Row row
{
if(dataHolder)
{
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder);
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)(intptr)dataHolder);
if(type.type == structClass)
{
- void * dataPtr = (void *)dataHolder;
+ void * dataPtr = (void *)(intptr)dataHolder;
delete dataPtr;
}
dataHolder = 0;
if(dataType && dataType.type == structClass)
{
- dataHolder = (int64)new0 byte[dataType.structSize];
- data = (void *)dataHolder;
+ dataHolder = (int64)(intptr)new0 byte[dataType.structSize];
+ data = (void *)(intptr)dataHolder;
}
else if(dataType && (dataType.type == noHeadClass || dataType.type == normalClass))
{
if(eClass_IsDerived(dataType, class(String)))
- dataHolder = (int64)CopyString("");
+ dataHolder = (int64)(intptr)CopyString("");
else
- dataHolder = (int64)eInstance_New(dataType);
+ dataHolder = (int64)(intptr)eInstance_New(dataType);
data = (void *)&dataHolder;
}
else
void Clear()
{
- if(visible)
- {
- if(data)
- SetData(null, false);
-
- if(type && (type.type == noHeadClass || type.type == normalClass))
- {
- if(eClass_IsDerived(type, class(String)))
- dataHolder = (int64)CopyString("");
- else
- dataHolder = (int64)eInstance_New(type);
- data = (void *)&dataHolder;
- }
+ if(data)
+ SetData(null, false);
- if(created)
- Refresh();
+ if(type && (type.type == noHeadClass || type.type == normalClass))
+ {
+ if(eClass_IsDerived(type, class(String)))
+ dataHolder = (int64)(intptr)CopyString("");
+ else
+ dataHolder = (int64)(intptr)eInstance_New(type);
+ data = (void *)&dataHolder;
}
+
+ if(created)
+ Refresh();
}
void Load()
{
- if(visible && field && row)
+ if(field && row)
{
SetData(null, false);
master.modifiedDocument = false;
if(!dataHolder && type && (type.type == noHeadClass || type.type == normalClass))
{
if(eClass_IsDerived(type, class(String)))
- dataHolder = (int64)CopyString("");
+ dataHolder = (int64)(intptr)CopyString("");
else
- dataHolder = (int64)eInstance_New(type);
+ dataHolder = (int64)(intptr)eInstance_New(type);
data = (void *)&dataHolder;
}
virtual void Save()
{
- bool result;
- if(visible && field && row)
+ if(field && row)
{
Class type = field.type;
if(!DataBox::SaveData())
void Init()
{
- if(visible && created)
+ if(created)
Refresh();
}
if(dataHolder)
{
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder);
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)(intptr)dataHolder);
if(type.type == structClass)
{
- void * dataPtr = (void *)dataHolder;
+ void * dataPtr = (void *)(intptr)dataHolder;
delete dataPtr;
}
dataHolder = 0;
showNone = true;
public:
- property uint filter { set { filtered = true; filter = value; } get { return filter; } }
+ property Id filter { set { filtered = true; filter = value; } get { return filter; } }
property bool filtered { set { filtered = value; } }
- property uint exclusion { set { exclusion = value; } }
+ property Id exclusion { set { exclusion = value; } }
property Field filterField { set { filterField = value; } }
property Field nameField { set { nameField = value; } }
virtual void TableDropBox::RefillFunction();
if(editor)
{
TableDropBox dropBox = (TableDropBox) editor;
- uint id = data ? *(uint *)data : MAXDWORD;
+ Id id = data ? *(Id *)data : MAXDWORD;
OnConfigure(dropBox);
dropBox.Refill();
if(id != MAXDWORD) dropBox.SelectRow(dropBox.FindSubRow(id));
private:
Field nameField;
Field filterField;
- uint exclusion;
- uint filter;
+ Id exclusion;
+ Id filter;
bool filtered;
bool showNone;
}
FieldDataBox::Save();
}
- virtual bool OnAddTextEntry(Row row, TableDropBox dropBox, char * entry)
+ virtual bool OnAddTextEntry(Row row, TableDropBox dropBox, const char * entry)
{
row.Add();
row.SetData(dropBox.nameField, entry);
{
if(listSection.fldId && listSection.fldName)
{
- bool stringName = !strcmp(listSection.fldName.type.dataTypeString, "char *");
+ Class type = listSection.fldName.type;
+ bool stringName = !strcmp(type.dataTypeString, "char *");
while(r.Next())
{
Id id = 0;
if(stringName)
r.GetData(listSection.fldName, s);
else
- s = PrintString("Entry ", id);
+ {
+ s = GetNameString(r, listSection.fldName);
+ // s = PrintString("Entry ", id);
+ }
listSection.list.AddString(s).tag = id;
delete s;
}
list.NotifySelect(this, list, null, 0);
if(!editor.modifiedDocument)
{
- uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
+ Id id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
Row r { table };
if(r.Last()) // this will reuse ids in cases where the item(s) with the last id have been deleted
bool result = true;
if(/*row && */row != lastRow)
{
- uint id;
if(editor.modifiedDocument)
{
if(row)
}
};
- virtual void Window::NotifySelectListRow(ListSection listSection, uint64 id);
+ virtual void Window::NotifySelectListRow(ListSection listSection, Id id);
void SelectListRow(DataRow row)
{
// Time startTime = GetTime();
if(row)
{
- uint64 id = row.tag;
+ Id id = row.tag;
lastRow = row;
if(list.currentRow != row)
{
if(editor)
{
- editor.btnSave.disabled = !(bool)list.currentRow;
- editor.btnReload.disabled = !(bool)list.currentRow;
- btnDelete.disabled = !(bool)list.currentRow;
- editor.disabled = !(bool)list.firstRow;
+ editor.btnSave.disabled = !list.currentRow;
+ editor.btnReload.disabled = !list.currentRow;
+ btnDelete.disabled = !list.currentRow;
+ editor.disabled = !list.firstRow;
}
}