On 27-sep-06, at 18:29, CV wrote:


On Sep 27, 2006, at 8:17 AM, Bart Pietercil wrote:

Hi,

this worked:

defined and filled CurrentStudentRecord as a Dictionary having the DBColumnName as Key

defined a subclass from editfield named sqlite_field
with an extra property DBColumnName

added an interface to the class  with a DisplayStudentInfo method

defined App.StudentFields() As sqlite_fields

in the change event of my listbox the code

for i = 0 to Ubound(App.StudentFields)
App.StudentFields(i).DisplayInfo
next

updates all the sqlite_fields with their appropriate values

JOY

now I want to add some popupmenus to the dance

so I subclassed a popupmenu as sqlite_pumenu that interfaces with the DisplayStudentInfo method

-------
this does not work and where I am at lost

I cannot add my sqlite_pumenu's to App.StudentFields (it is not a sqlite_field)

I changed the StudentFieldsArray to type Control. This seems to work as RB does not complain when I add the sqlite_xxxx to the array. However RB does not accept the line App.StudentsFields (i).Displayinfo . This line only seems to work when the array is of type sqlite_field

At this point you should be able to cast to expose the subclass functionality: Sqlite_field(App.StudentsFields(i)).DisplayInfo, since, as I understand it, App.StudentsFields(i) of data type Control is actually a Sqlite_field.

Although I hadn't thought about casting this seems to be defying the purpose since what I want to achieve is an array consisting of several kinds of controls (editfields,popupmenu,radios,checkboxes,....) which share (through the interface) the DisplayInfo method. In this way I hoped to avoid a lot of "cases" and "Isa's"; If I am to follow your lead on this, I would still have to introduce "isa sqlite_pumenu" or "isa sqlite_field" checking , wouldn't I ?


Perhaps a dictionary would be a better design choice than any array, however.


I've been thinking about this. Since I have already a dictionary representing the SelectedStudent (key = DBColumnName, Value = DBValue), I could make a "mirroring" Dictionary built on DBColumnname and the object representing the info on screen. But wouldnt I still need to cast ? Or should this work:

myDict.Value("DBColumnName").DisplayInfo ?


Thanks for bearing with me

Bart



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to