classobjectweb-applicationspropertiesxojo

How can I access a property of a subclass on Xojo dynamically?


On a Xojo WebApp I created a TextFieldClass with a property "required as boolean".

On a webpage, I have some TextFieldClass objects.

What I want to do is simple… I want to do a self.ControlCount on the webpage, and check if all textFieldClass with the required property with "true" value in fact have contents in it.

Easy, right?…

Dim i as integer
Dim c As textFieldClass
For i=0 To self.ControlCount
    if self.ControlAtIndex(i) isa textFieldClass then
        **c=self.ControlAtIndex(i) // i got an error… expected class textFieldClass, but got class webObject…**
    End If
Next

And if I try:

Dim i as integer
Dim c As WebObject
For i=0 To self.ControlCount
    if self.ControlAtIndex(i) isa textFieldClass then
        c=self.ControlAtIndex(i)
        **if c.required then // I got an error… Type "WebObject" has no member named "required"**
            // do something here…
        end if
    End If
Next

Thanks for your help!


Solution

  • Try this:

    c = TextFieldClass(self.ControlAtIndex(i))