set the textStyle to not bold

Richard Gaskin ambassador at fourthworld.com
Mon Oct 5 10:42:14 EDT 2009


Beat wrote:
> Thanks for all your input. Interesting to get to know some more about  
> HTML.
> 
> But I think  I have to approach what I want from a different angle. I  
> want to mark some parts of a formatted text and be able to get the  
> star- and end character positions of these parts of the text. When I  
> delete or add text, the character  positions of the marked text must  
> adapt. So when I am done, I have the exact char positions of all the  
> marked text. The marking should be visible during the adding and  
> removing of text parts and be thrown away in the end. Now boxed is  
> clear and does in my case not interfere with other textStyles in the  
> field. But applying box to a already formatted text is very  
> unpredictable. Sometimes the f.i. bold part stays bold when applying  
> box, sometimes it changes to plain. I have been thinking about 'link'  
> text (which has the advantage of easily linking some info with it.  
> But the style is like underline, so not usable for me. I think I go  
> back to setting the backColor of the parts I want to temporaly mark.  
> I can then check the start- and end char positions easily.
> The disadvantage is that you don't see the selection in the parts  
> with a backColor set.
> Anyone an idea on how to resolve this?

I learned an interesting trick from Jeanne DeVoto not long ago which may 
be useful here:

You can use an anchor tag with no href and it will not show as 
underlined, but can store arbitrary textual data in the anchor tag's 
"name" attribute.

Try this test:

1. Make a stack with two fields and a button.


2. Put this in the script of the button:

   on mouseUp
     set the htmlText of fld 2 to the text of fld 1
   end mouseUp


3. Put this in field 1:

   <p><a name="Some arbitrary data">This is a test</a></p>


4. Click the button.  Now you should see "This is a test"
    in field 2 without the customary underline you might
    expect for linked text.

    But what happened to the data in the "name" attribute?


5. Run this in the message box:

    put the htmltext of fld 2

Now you should see:

    <p><a name="Some arbitrary data">This is a test</a></p>


This allows you to use anchor tags to stash info for specific runs of 
text without altering the appearance of that text.

Hope that helps -

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list