Hi,
The following will illustrate what I'm after...
assume one has a class (methods and properties are left out for easier understanding)
and another class inheriting the ifield interface
There would be a bunch of other classes that mimic the usage of controls
in a window. but for illustration purposes the checkbox will suffice.
Now, I have a form class with a method AddField and GetField which
would look like this
Now, I wish I could evaluate for certain interfaces.
So, all this stuff just to ask, can we get the interface name of an
object by some kind of trick ?
Cheers
Steven
The following will illustrate what I'm after...
assume one has a class (methods and properties are left out for easier understanding)
Code:
class cField interface iField inherit Dual end interface end class
Code:
class cCheckbox interface iCheckbox inherit cField, iField end interface end class
in a window. but for illustration purposes the checkbox will suffice.
Now, I have a form class with a method AddField and GetField which
would look like this
Code:
class cForm interface iForm inherit Dual method Addfield(ByVal clsField as Dispatch) ... collection handling is here... actually just an dispatch array holding the clsfield object end method method GetField(byVal nId as long) as Dispatch ... lookup field here by evaluating the id which ... is a property of the iField interface. myDispatch = m_FieldCol(n) method = myDispatch end method end method end Class
Code:
Local clsField as Dispatch clsField = MyForm.GetField(Id) select case <INTERFACE QUERY ON OBJECT HERE> case "IFIELD" ' Base class \ Case "ICHECKBOX" ' A checkbox... what can we do with a checkbox that we can't do with the baseclass. ' We need to use object Call here since we're referencing ' a dispatch interface instead of the direct interface. Object Call clsField.SetTrue() End Select
object by some kind of trick ?
Cheers
Steven
Comment