[squeakland] How can I evaluate an Expression in Text
Ricardo Moran
richi.moran at gmail.com
Wed Mar 30 17:28:14 EDT 2011
Hi Steve,
>From a script of the text object you can write:
Compiler evaluate: self getCharacters.
and if the text contains a valid smalltalk expression it will work,
otherwise it will throw an error. I don't remember exactly how to catch
syntax errors, though. I did it for the spreadsheet object last year, but I
wasn't sure if that's the right way.
As for the format, I have no idea. Sorry.
Cheers,
Richo
On Wed, Mar 30, 2011 at 6:06 PM, Steve Thomas <sthomas1 at gosargon.com> wrote:
> So if I have a Text Object with the "characters" value: (5 + 2) / 2
> How can I set the numeric value of another text object (or any variable of
> Type Number) to the "evaluated" value?
>
> Ie: how can I set the value to the equivalent of <CMD-P>?
> Also how can I specify the format as either "7/2" or 3.5?
>
> Thanks,
> Stephen
>
> _______________________________________________
> squeakland mailing list
> squeakland at squeakland.org
> http://lists.squeakland.org/mailman/listinfo/squeakland
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/squeakland/attachments/20110330/dbe5fa43/attachment.html>
More information about the squeakland
mailing list