Page 1 of 1

Lists and strings and classes

PostPosted: Dec 5, 2004 @ 7:11pm
by PointOfLight
I have a class that contains a list as one of it's private members. I'd like to have a function, say class.RetrieveElement(index$), that retrieves an item from this list and returns that element to the user. Or, worst case scenario, I would pass the variable to store the element of the list in as the second variable. So my syntax would either be:

x$ = class.RetrieveElement(1);

or:

class.RetrieveElement(1, &x$);

Now the element will be a string, and I can't seem to get the value out of the class. No matter what I do, x$ always ends up being the address of the element, not the value of the element. Please help!

PostPosted: Dec 6, 2004 @ 3:55pm
by kornalius

PostPosted: Dec 6, 2004 @ 4:00pm
by PointOfLight

PostPosted: Dec 6, 2004 @ 4:23pm
by PointOfLight
Just to verify, I first tried a return(@data$);. This gave me the "address misaligned" error. Then I left out the @ in the return statement and tried ShowMessage(@val$);, where val$ is the variable assigned to the return of the function. There was no error, but the value displayed was still the address, not the actual value of the string.

PostPosted: Dec 6, 2004 @ 5:57pm
by kornalius

PostPosted: Dec 6, 2004 @ 6:27pm
by PointOfLight

PostPosted: Dec 6, 2004 @ 6:39pm
by kornalius
No problem, we could have discovered something buggy along the way! ;)