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

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to