[comp.sys.mac.hypercard] Effect of setting text tool properties

gasp@bu-cs.BU.EDU (Isaac Kohane) (09/04/89)

Hi,

	the following behavior in Hypercard has me puzzled. If you have a
script which goes as follows:

	lock screen
	choose text tool
	set textAlign to center
        type "Foo"
        .
         .
         .
         set textAlign to right
         type "Bar"
         unlock screen

then both Foo and Bar end up right aligned. A similar phenomenon happens
when you set to differerent font sizes and other properties of the text tool
from within a script. Any explanations?



		thanks-

		-Zak

dlugose@ecsvax.uncecs.edu (Dan Dlugose) (09/05/89)

In article <37513@bu-cs.BU.EDU> gasp@bucsd.bu.edu (Isaac Kohane) writes:
>	the following behavior in Hypercard has me puzzled. If you have a
>script which goes as follows:
>
>	lock screen
>	choose text tool
>	set textAlign to center
>        type "Foo"
>        .
>         set textAlign to right
>         type "Bar"
>         unlock screen
>
>then both Foo and Bar end up right aligned. A similar phenomenon happens

   This behavior is as it would be in MacPaint.  When using the text
tool, you can't mix text characteristics within the same string being 
painted on the screen.  To mix text characteristics, you have to click
the text cursor in a different place, such as to the right of where
your first set of text ends.
   Just add "click at x,y" between the two strings which are to have
different characteristics.  Of course, figuring out exactly where you
want to click is a bit difficult.

Dan Dlugose
UNC Educational Computing Service

shani@TAURUS.BITNET (09/06/89)

In article <37513@bu-cs.BU.EDU>, gasp@bu-cs.BU.EDU (Isaac Kohane) writes:
>       the following behavior in Hypercard has me puzzled.
>...
>       set textAlign to center
>         type "Foo"
>....
>          set textAlign to right
>          type "Bar"
>....
>
> then both Foo and Bar end up right aligned.

This is exactly as if you choose the text tool from the toolbox and then
changing text style without rechoosing the text tool, because text style
reguards the whole of the text entered since the text tool was selected
(same thing will happen in MacPaint, for instance...), so all you have to do
is to add the line

  choose text tool

into your script, before the

  set textAlign to right

O.S.

Barry.Chern@f200.n226.z1.FIDONET.ORG (Barry Chern) (09/08/89)

Isaac Kohane writes:
>set textAlign to center
>        type "Foo"
>         set textAlign to right
>         type "Bar"
>         unlock screen
>
>then both Foo and Bar end up right aligned.
 
The simple sad answer is that HyperCard only allows one style per field.
Whatever size, style and aligment of text you specify last is what the
whole field will look like. Try your scripts putting each style into a
different field.


--  
Barry Chern via cmhGate - Net 226 fido<=>uucp gateway Col, OH
UUCP: ...!osu-cis!n8emr!cmhgate!200!Barry.Chern
INET: Barry.Chern@f200.n226.z1.FIDONET.ORG