[Gambas-user] casting, macro change from str to resultfield?
Benoit Minisini
gambas at ...1...
Tue Jan 3 10:37:21 CET 2006
On Tuesday 03 January 2006 10:29, johnf wrote:
> On Tuesday 03 January 2006 01:10, ron wrote:
> > On Tuesday 03 January 2006 08:34, johnf wrote:
> > > On Monday 02 January 2006 23:30, johnf wrote:
> > > > On Monday 02 January 2006 23:18, ron wrote:
> > > > > oopfield = hfield.Value
> > > >
> > > > Thanks that should work.
> > > >
> > > > But I also realized that Gambas is a compiled lang - therefore there
> > > > is nothing like macro substitution....
> > > >
> > > > Thanks again
> > > > John
> > >
> > > Dam I thought you had the answer. But hfield does not have "Value".
> > >
> > > But I wonder if something else does? I'll continue to check.
> > > BTW I'm using 1.9.23
> > > Thanks
> > > John
> >
> > Did a look in the help
> > gb.db.result:
> >
> >
> > DIM hResult AS Result
> > DIM aVariant AS Variant
> >
> > aVariant = hResult [ Field AS String ]
> >
> >
> > Returns the value of a field in the current record of the Result object.
> >
> > should be then:
> >
> > FOR EACH hfield IN contactdata.Fields
> > INC i
> > loopfield = contactdata[hfield.Name]
> > contacts[c, i].Text = loopfield
> > NEXT
> >
> > contactdata = result
> > contacts = gridview
> >
> > I hoop this wil do the job.
> >
> > Ron
>
> This works thank you very much. It's 1:am here and I'm very tired so I'm
> going to bed. But I want to understand your process of determining the
> correct way to get to the field. I need to be able to do the same thing.
> But when I read the help file I did not understand the notation. But you
> did! So if you can take some more time could you explain it. If this like
> trying to explain OOP then don't of course. But maybe there is some link
> or text in the help file that will explain the notation?
>
> Again thanks
>
>
>
> PS I think have a little understanding as I re-read the message. Is
> aVariant one of my controls (or any data type?).
>
> John
>
The help is automatically generated, so the syntax is not very clear for array
accessors, and sub-objects.
What you wanted is just a matter of syntax: in Gambas, a[b] <=> a!b. It
compiles the same code.
Regards,
--
Benoit Minisini
More information about the User
mailing list