[Gambas-user] Function doing unexpected things...
Benoit Minisini
gambas at ...1...
Thu Jul 20 12:53:27 CEST 2006
On Thursday 20 July 2006 04:34, sbungay wrote:
> How to explain this without writing tons of code... hmmmmm.. here goes.
> I have a class which contains 3 public variables of type float.
> The class gets instantiated.
> One of the items within the class is named "subtotal" and it's value
> is derived by summing up the items in one column of a grid. To do this I
> wanted to use a function which returned type Float. So (keeping code
> here to a minimum) the whole mess looks kind of like this...
>
> ClassName.SubTotal = ComputeSubTotal(GridName,GridName.Column)
>
> Private Function ComputeSubTotal (SourceGrid AS GridView, Col as
> Integer) AS Float
> Dim SubTotal AS Float
> .
> .
> .
> Logic to sum the column into "SubTotal" goes here
> .
> .
> .
> Return SubTotal
> End
>
> Gives me the error
>
> "Expected Float, got Function"
>
> I expected the assignment to take the return value of the function
> not the function itself... is this a bug or am I doing something wrong?
> I can work around it using a SUB but IMHO it is more elegant to use a
> function.
>
> P.S.
> Haven't used GAMBAS for over a year, just downloaded the latest
> version and compiled it... it's looking very good Benoit. I like the new
> editor.
>
It seems to be a bug. I need the version of Gambas you use, and the complete
source code of the module/class where the function is located.
Regards,
--
Benoit Minisini
More information about the User
mailing list