[Gambas-user] Access a property via string (Introspection like)
Juan Jose Costello Levien
jclevien at ...626...
Wed Jun 24 18:41:43 CEST 2009
Hello,
I want to set a property value using strings for, accesing a form, then
a grid, then a cell inside the grid, the text property and finally set
the value for it.
Here a wannabe code that obviously is failing to do the idea:
PUBLIC SUB setMatrix(path AS String, dims AS Integer[], prop AS String,
Valor AS String)
' Divido a path por los puntos
DIM s AS String[]
DIM cad AS String
DIM c AS Control
DIM g AS GridView
DIM f AS Form
DIM o AS Object
DIM i AS Integer
s = Split(path, ".")
IF s.Count = 0 THEN
Message("Revisar argumentos")
END IF
FOR i = 0 TO Windows.Count - 1
IF (Lower(s[0]) = Lower(Windows[i].Name)) THEN
f = Windows[i]
EXIT
END IF
NEXT
IF NOT IsNull(f) THEN
g = f[s[1]]
g.row = dims[0]
g.column = dims[1]
Object.SetProperty(g.Current, prop, Valor)
END IF
END
As you can imagine, Gambas stops on the "Object.SetProperty" line,
complaining about that it cannot use the "virtual" class that g.Current
belongs to.
I need this because the idea is to access in runtime to any
object/property/method from outside gambas (for example, a Python
script).
Any help would be greatly appreciated.
--
Juan Jose Costello Levien
jclevien at ...626...
"Not good, not bad, only reasonable"
"Ni bueno ni malo, solo razonable"
ASCII ribbon campaign ( )
against HTML e-mail X
/ \
More information about the User
mailing list