[Newbies] (no subject)
Herbert König
herbertkoenig at gmx.net
Sun May 9 19:51:46 UTC 2010
Hi John,
JF> My problem is how to display a fraction so it looks like a fraction, and
JF> not like (2/5) + (7/8). I want the vinculum to be a horizontal line:
JF> 2 7 61
JF> --- + --- = ----
JF> 5 8 40
JF> Can anyone point me at example code on how to get things formatted nicely?
each Fraction understands numerator and denominator so you have the
numbers. Just try in a Workspace 1234567 printString asMorph
openInHand.
Now you have your Morphs, each of which understands bounds to give you
the top left and bottom right corner.
Then with position: topLeftCorner you can move them around and draw
your vinculum (thanks for a new word :-)) as a LineMorph with the
class side method
from: startPoint to: endPoint color: lineColor width: lineWidth
between your numbers
Then add them with addMorph: to whatever you use as a display.
JF> Pointers to existing code would be ideal, so I can understand things,
JF> rather than just dropping a solution on me.
Well hope that helps with understanding.
Cheers,
Herbert
More information about the Beginners
mailing list