[Gambas-user] SetProperty Virtual Object Dynamically
Benoit Minisini
gambas at ...1...
Sun Nov 30 22:04:34 CET 2008
On mardi 25 novembre 2008, L Jumadi wrote:
> > On samedi 22 novembre 2008, L Jumadi wrote:
> >> On vendredi 21 novembre 2008, L Jumadi wrote:
> >> > I just want to know wheter gambas can set property inside a virtual
> >> > collection. For Example I try to set Rows.H of a Gridview, I try
> >>
> >> command
> >>
> >> > like this:
> >> >
> >> > Object.SetProperty(Obj,"Rows.H",10)
> >> >
> >> > (Where Obj is a Gridview, and of course "Rows.H" usually a variable)
> >> >
> >> > It return error. Is there any other way to do it? I have trouble to
> >> > read property too (Dynamically), but someway gambas debugger can read
> >> > it properly (I think it should use to read it dynamically). Am I
> >> > missing something?
> >> >
> >> >You can't do that with Object.SetProperty. But the question is: why do
> >> > you use Object.SetProperty?
> >> >
> >> >You can use an Object reference:
> >> >
> >> >DIM hObject AS Object = Obj
> >> >hObject.Rows.H = 10
> >> >--
> >> >Benoit Minisini
> >>
> >> Of course I do that because actually Rows.H is a data in a database.
> >> FYI: Right now I create a database driven application with gambas. So
> >> I never use any of gambas form (Can you Imagine that?!) but can
> >> display GUI like if we use a form. Everything driven by the data. From
> >> the data my program create the form dynamically. So user (actually
> >> it's me as programmer) can modify the property of an object just by
> >> editting the data. So far it going well until i want to modify the
> >> rows.h. May be I can intercept that with some other code, but in the
> >> future if there is many virtual object like this I must code it one by
> >> one. So if there any solution for this I can set other "maybe in the
> >> future" virtual object.
> >
> > Then you can use the Eval() function:
> >
> > Dim hGridView As GridView
> > Dim cValue As New Collection
> > Dim sProp As String = "Row.H"
> >
> > cValue["This"] = hGridView
> >
> > Print Eval("This." & sProp, cValue)
> > --
> > Benoit Minisini
>
> Ok, that's solve the Read property function, how about setproperty?
> can I use Eval? Or may be there is another way, tks.
>
Mmm. You get a point there... I must think about that before finding a
solution.
Regards,
--
Benoit Minisini
More information about the User
mailing list