4 extern int __ecereVMethodID_class_OnCompare;
6 class MainForm : Window
10 text = "Drugs Database";
11 background = activeBorder;
12 borderStyle = sizable;
18 Window tabButtons { this, tabCycle = true, background = activeBorder, size = { h = 24 }, anchor = { bottom = 5, left = 10, right = 10 } };
19 MedTesting testForm { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 } };
20 UnitesEditor untEditor { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 }, autoCreate = false };
21 FormesEditor frmEditor { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 }, autoCreate = false };
22 SubClassesEditor sclEditor { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 }, autoCreate = false };
23 ClassesEditor clsEditor { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 }, autoCreate = false };
24 RestrictionEditor rstEditor { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 }, autoCreate = false };
25 MedEditor medEditor { this, anchor = { left = 0, top = 0, right = 0, bottom = 30 }, autoCreate = false };
33 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
35 if(curView.Destroy(0))
37 curButton.checked = false;
38 button.checked = true;
39 curView = (Window)button.id;
47 Button tabTst { tabButtons, checked = true, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 6 * 80 }, text = "Test", id = (int64)testForm, NotifyClicked = NotifyClicked };
48 Button tabUnt { tabButtons, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 5 * 80 }, text = "Units", id = (int64)untEditor, NotifyClicked = NotifyClicked };
49 Button tabFrm { tabButtons, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 4 * 80 }, text = "Forms", id = (int64)frmEditor, NotifyClicked = NotifyClicked };
50 Button tabScl { tabButtons, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 3 * 80 }, text = "Sub-Classes", id = (int64)sclEditor, NotifyClicked = NotifyClicked };
51 Button tabCls { tabButtons, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 2 * 80 }, text = "Classes", id = (int64)clsEditor, NotifyClicked = NotifyClicked };
52 Button tabRes { tabButtons, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 1 * 80 }, text = "Restrictions", id = (int64)rstEditor, NotifyClicked = NotifyClicked };
53 Button tabMed { tabButtons, master = this, stayDown = true, size = { 70, 20 }, anchor = { right = 10 + 0 * 80}, text = "Drugs", id = (int64)medEditor, NotifyClicked = NotifyClicked };
56 class RestrictionEditor : Window
60 ListSection list { this, editor = editor, fldName = dbfield("Restrictions", name), table = dbtable("Restrictions"), anchor = { left = 0, top = 0, bottom = 0, right = 0.5 } };
61 EditSection editor { this, table = dbtable("Restrictions"), anchor = { left = 0.5, top = 0, bottom = 0, right = 0 } };
63 FieldDataBox boxName { editor = editor, field = dbfield("Restrictions", name), text = "Name", size = { 174, 20 }, position = { 20, 32 } };
64 Label label1 { editor.editArea, position = { 20, 8 }, labeledWindow = boxName };
67 class ClassesEditor : Window
70 background = activeBorder;
72 ListSection list { this, editor = editor, fldName = dbfield("DrugClasses", name), table = dbtable("DrugClasses"), anchor = { left = 0, top = 0, bottom = 0, right = 0.5 } };
73 EditSection editor { this, table = dbtable("DrugClasses"), anchor = { left = 0.5, top = 0, bottom = 0, right = 0 } };
75 FieldDataBox boxName { editor = editor, field = dbfield("DrugClasses", name), text = "Name", size = { 174, 20 }, position = { 20, 32 } };
76 Label label1 { editor.editArea, position = { 20, 8 }, labeledWindow = boxName };
79 class SubClassesEditor : Window
82 background = activeBorder;
83 ListSection list { this, editor = editor, fldName = dbfield("SubClasses", name), table = dbtable("SubClasses"), anchor = { left = 0, top = 0, bottom = 0, right = 0.5 } };
84 EditSection editor { this, table = dbtable("SubClasses"), anchor = { left = 0.5, top = 0, bottom = 0, right = 0 } };
86 FieldDataBox boxName { editor = editor, field = dbfield("SubClasses", name), text = "Name", size = { 174, 20 }, position = { 20, 32 } };
87 Label label1 { editor.editArea, position = { 20, 8 }, labeledWindow = boxName };
90 class FormesEditor : Window
93 background = activeBorder;
95 ListSection list { this, editor = editor, fldName = dbfield("Forms", name), table = dbtable("Forms"), anchor = { left = 0, top = 0, bottom = 0, right = 0.5 } };
96 EditSection editor { this, table = dbtable("Forms"), anchor = { left = 0.5, top = 0, bottom = 0, right = 0 } };
98 FieldDataBox boxName { editor = editor, field = dbfield("Forms", name), text = "Name", size = { 174, 20 }, position = { 20, 32 } };
99 Label label1 { editor.editArea, position = { 20, 8 }, labeledWindow = boxName };
102 class UnitesEditor : Window
105 background = activeBorder;
106 ListSection list { this, editor = editor, fldName = dbfield("Units", name), table = dbtable("Units"), anchor = { left = 0, top = 0, bottom = 0, right = 0.5 } };
107 EditSection editor { this, table = dbtable("Units"), anchor = { left = 0.5, top = 0, bottom = 0, right = 0 } };
109 FieldDataBox boxName { editor = editor, field = dbfield("Units", name), text = "Name", size = { 174, 20 }, position = { 20, 32 } };
110 Label label1 { editor.editArea, position = { 20, 8 }, labeledWindow = boxName };
113 class MedEditor : Window
116 background = activeBorder;
117 ListSection list { this, editor = editor, fldName = dbfield("Drugs", genericName), table = dbtable("Drugs"), anchor = { left = 0, top = 0, bottom = 0, right = 0.5 } };
118 EditSection editor { this, table = dbtable("Drugs"), anchor = { left = 0.5, top = 0, bottom = 0, right = 0 } };
120 FieldDataBox boxGenericName { editor = editor, field = dbfield("Drugs", genericName), text = "Generic Name", size = { h = 20 }, anchor = { left = 20, top = 32, right = 20 } };
121 FieldDataBox boxCommercialNames { editor = editor, field = dbfield("Drugs", commercialNames), text = "Commercial Names", size = { h = 67 }, anchor = { left = 20, top = 88, right = 20 } };
123 FieldDataBox boxSubClass { editor = editor, field = dbfield("Drugs", subClass), text = "Sub Class", size = { h = 20 }, anchor = { left = 20, top = 192, right = 20 } };
124 FieldDataBox boxClass { editor = editor, field = dbfield("Drugs", drugClass), text = "Class", size = { h = 20 }, anchor = { left = 20, top = 248, right = 20 } };
126 FieldDataBox boxRestriction { editor = editor, field = dbfield("Drugs", restriction), text = "Restriction", size = { h = 20 }, anchor = { left = 20, top = 290, right = 20 } };
128 FieldDataBox boxFormConcentrations { editor = editor, field = dbfield("Drugs", formConcentrations), text = "Form & Concentrations", size = { h = 80 }, anchor = { left = 20, top = 330, right = 20 } };
130 Label label1 { editor.editArea, position = { 20, 8 }, labeledWindow = boxGenericName };
131 Label label2 { editor.editArea, position = { 20, 64 }, labeledWindow = boxCommercialNames };
132 Label label3 { editor.editArea, position = { 20, 168 }, labeledWindow = boxSubClass };
133 Label label4 { editor.editArea, position = { 20, 224 }, labeledWindow = boxClass };
134 Label label5 { editor.editArea, position = { 20, 270 }, labeledWindow = boxRestriction };
135 Label label6 { editor.editArea, position = { 20, 310 }, labeledWindow = boxFormConcentrations };
137 Label spacer { editor.editArea, position = { 20, 420 }, size = { h = 10 } };
140 class MedTesting : Window
145 background = activeBorder;
146 anchor = { left = 0, top = 0, right = 0, bottom = 30 };
148 FieldDataBox boxGenericName { this, text = "Generic Name", size = { 238, 20 }, position = { 16, 40 }, field = dbfield("Drugs", genericName), row = row};
149 FieldDataBox boxCommercialNames { this, text = "Commercial Names", size = { 238, 67 }, position = { 16, 96 }, field = dbfield("Drugs", commercialNames), row = row };
150 FieldDataBox boxClass { this, text = "Class", size = { 238, 20 }, position = { 272, 40 }, field = dbfield("Drugs", drugClass), row = row };
151 FieldDataBox boxSubClass { this, text = "Sub Class", size = { 238, 20 }, position = { 272, 96 }, field = dbfield("Drugs", subClass), row = row };
152 FieldDataBox boxRestriction { this, text = "Restriction", size = { 238, 20 }, position = { 272, 152 }, field = dbfield("Drugs", restriction), row = row };
153 FieldDataBox boxFormConcentrations { this, text = "Form & Concentrations", size = { 240, 80 }, position = { 272, 208 }, field = dbfield("Drugs", formConcentrations), row = row };
155 Label etude { this, text = "Study Method", inactive = false, size = { 233, 77 }, position = { 16, 176 }, isGroupBox = true };
158 etude, this, "Give out generic name", size = { 146, 15 }, position = { 16, 24 }, isRadio = true, checked = true;
160 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
162 boxGenericName.Load();
168 etude, this, "Give out commercial names", size = { 170, 15 }, position = { 16, 48 }, isRadio = true;
170 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
172 boxCommercialNames.Load();
179 this, text = "Draw Next", position = { 16, 264 };
181 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
186 Drug id = GetRandom(1, range);
187 if(row.Find(dbfield("Drugs", id), middle, 0, id))
189 boxCommercialNames.foreground = black;
190 boxGenericName.foreground = black;
191 boxSubClass.foreground = black;
192 boxClass.foreground = black;
193 boxRestriction.foreground = black;
194 boxFormConcentrations.foreground = black;
196 if(generique.checked)
198 boxGenericName.Load();
199 boxCommercialNames.Clear();
203 boxCommercialNames.Load();
204 boxGenericName.Clear();
208 boxRestriction.Clear();
209 boxFormConcentrations.Clear();
211 answers.disabled = false;
219 this, text = "Give out Answers", position = { 136, 264 };
221 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
223 StringList commercialNames = row.commercialNames;
224 String genericName = row.genericName;
225 SubClass subClass = row.subClass;
226 DrugClass drugClass = row.drugClass;
227 Restriction restriction = row.restriction;
228 FormConcentrations formConcentrations = row.formConcentrations;
230 // if(commercialNames.OnCompare(*(void **)boxCommercialNames.data))
231 if(class(StringList)._vTbl[__ecereVMethodID_class_OnCompare](class(StringList), commercialNames, *(void **)boxCommercialNames.data))
232 boxCommercialNames.foreground = red;
234 // if(genericName.OnCompare(*(void **)boxGenericName.data))
235 if(class(String)._vTbl[__ecereVMethodID_class_OnCompare](class(String), genericName, *(void **)boxGenericName.data))
236 boxGenericName.foreground = red;
238 if(drugClass.OnCompare(boxClass.data))
239 boxClass.foreground = red;
241 if(subClass.OnCompare(boxSubClass.data))
242 boxSubClass.foreground = red;
244 if(restriction.OnCompare(boxRestriction.data))
245 boxRestriction.foreground = red;
247 if(formConcentrations.OnCompare(boxFormConcentrations.data))
248 boxFormConcentrations.foreground = red;
250 boxCommercialNames.Load();
251 boxGenericName.Load();
254 boxRestriction.Load();
255 boxFormConcentrations.Load();
256 answers.disabled = true;
258 delete commercialNames;
260 formConcentrations.OnFree();
265 Label label1 { this, position = { 16, 16 }, labeledWindow = boxGenericName };
266 Label label2 { this, position = { 16, 72 }, labeledWindow = boxCommercialNames };
267 Label label3 { this, position = { 272, 72 }, labeledWindow = boxSubClass };
268 Label label4 { this, position = { 272, 16 }, labeledWindow = boxClass };
269 Label label5 { this, position = { 272, 128 }, labeledWindow = boxRestriction };
270 Label label6 { this, position = { 272, 184 }, labeledWindow = boxFormConcentrations };
271 Label spacer { this, position = { 20, 420 }, size = { h = 10 } };
275 next.NotifyClicked(this, next, 0,0, 0);
280 MainForm mainForm {};