On 1/28/00 10:41 AM, Craig Spooner <[EMAIL PROTECTED]> wrote:
>I have a field which contains short phrases that have been set to the
>"group" textStyle so that the clickText function will return the
>whole phrase. I would like to set the style to Bold when the user
>clicks on the phrases, then back to "normal" when something else gets
>clicked. The only way I can think to do it is to set everything to
>"plain," but then I lose the grouped text!
>
>What I guess I want is something like "set the textStyle ... to
>"notBold" Is that possible?
I don't know if notBold is possible, but this seems to work: I created a
field and set its script to the following:
on mouseUp
global oldStyle, oldchunk
put the clickChunk into newChunk --store these, we'll need them later
put the textStyle of the ClickChunk into newStyle
if oldChunk is not empty then --the first time, there is no value
--this seems to erase the clickChunk value:
set the textStyle of oldChunk to oldStyle --unbold the original
end if
put newStyle into oldStyle --remember for later
put newChunk into oldChunk
select newChunk --hilite to show what we're working on
if newStyle is empty then --plain text
put newChunk --so I can see what it's doing; remove for production
set the textStyle of newChunk to "Bold" --set the style of the
clickChunk
else --has formatting
put ",Bold" after newStyle --add bold to the style
put newChunk && newStyle --debugging here; remove in production
set the textStyle of newChunk to newStyle --set the style
end if
wait 1 second
select empty --remove the hilite
end mouseUp
It adds bold to the current formatting of text that is clicked, and puts
back the original formatting of the text when something else is clicked.
It even works on bolded text. I guess MetaCard doesn't mind a textStyle
of "Bold,Bold" :-)
One thing to consider is that the bolding changes the size of the text.
This can lead to odd (although seemingly correct) behavior, as the thing
you click shifts suddenly to the left because something before it just
became plain text, having been bolded by the last click.
Anyway, there you go.
gc
Geoff Canyon
[EMAIL PROTECTED]
Your child can learn to read using the classics of children's literature.
Check out C.D. Caterpillar: <http://www.inspiredlogic.com/cd/>
This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm