2 public import static "ecere"
3 public import static "EDA"
9 class ConcentrationEditor : Window
17 static void UnusedFunction()
22 extern int __ecereVMethodID_class_OnSaveEdit;
23 extern int __ecereVMethodID_class_OnGetString;
33 bool Window::NotifyChanged(bool closed)
35 master.master.modifiedDocument = true;
39 void OnDisplay(Surface surface, int x, int y, int width, void * fieldData, Alignment alignment, DataDisplayFlags displayFlags)
42 char amountString[256];
45 //amount.OnGetString(amountString, null, null);
48 sprintf(string, "(Click here to add)");
52 class(double)._vTbl[__ecereVMethodID_class_OnGetString](class(double), &amount, amountString, null, null);
55 String formName = form.name;
56 String unitName = unit.name;
57 sprintf(string, "%s: %s %s", formName ? formName : "", amountString, unitName ? unitName : "");
62 sprintf(string, "(Click here to add)");
64 surface.WriteText(x, y, string, strlen(string));
67 Window OnEdit(DataBox dataBox, DataBox obsolete, int x, int y, int w, int h, void * userData)
71 ConcentrationEditor editor
75 anchor = { 0, 0, 0, 0 };
78 editor.formEditor = { editor, type = class(Form), data = &form, anchor = { top = 0, bottom = 0, left = 0, right = 0.66 }, NotifyChanged = NotifyChanged };
79 editor.amountEditor = { editor, type = class(double), data = &amount, anchor = { top = 0, bottom = 0, left = 0.34, right = 0.33 }, NotifyChanged = NotifyChanged };
80 editor.unitEditor = { editor, type = class(Unit), data = &unit, anchor = { top = 0, bottom = 0, left = 0.66, right = 0 }, NotifyChanged = NotifyChanged };
87 bool OnSaveEdit(ConcentrationEditor editor, void * object)
89 Concentration _this = this;
90 if(this && !_this.form)
97 editor.amountEditor.SaveData();
101 void OnFree() { } // WE DON'T WANT THE LISTBOX TO DELETE THE INSTANCES...
104 struct FormConcentrations : DataList
106 class_property(type) = "Concentration";
109 dbtable "Restrictions" Restriction
115 dbtable "DrugClasses" DrugClass
121 dbtable "SubClasses" SubClass
142 String genericName "Generic Name";
143 StringList commercialNames "Commercial Names";
144 Restriction restriction "Restriction";
145 SubClass subClass "Sub Class";
146 DrugClass drugClass "Class";
147 FormConcentrations formConcentrations "Form and Concentrations";
153 class MyApp : GuiApplication
157 RandomSeed((uint)(GetTime() * 1000));
158 SetDefaultIdField("id");
159 SetDefaultNameField("name");
160 ds = DataSource { driver = "EDB" };
161 db = database_open(ds, "med");