Re: set the textStyle to not bold

2009-10-05 Thread Björnke von Gierke

for links that got clicked, there is a message: linkClicked
and it gets the content of the link's name as parameter, so for example:

on linckClicked theLink
  if  theLink begins with "http" then
revgourl theLink
 else
  beep
 end if
end linkClicked

On 5 Oct 2009, at 16:42, Richard Gaskin wrote:

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.


3. Put this in field 1:

 This is a test


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?



--

official ChatRev page:
http://bjoernke.com?target=chatrev

Chat with other RunRev developers:
go stack URL "http://bjoernke.com/chatrev/chatrev1.3b3.rev";

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-05 Thread Richard Gaskin

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:

  This is a test


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:

   This is a test


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
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Re: set the textStyle to not bold

2009-10-05 Thread Beat Cornaz
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?

Thanks, Beat

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-03 Thread Beat Cornaz

Jacqueline wrote :


Your script works as well as Devin's and also has the same  
'shortcoming'

of not removing the style between words.



>I haven't tested it, but it seems to me that you don't need to iterate
>through any chunks at all if you replace the entire htmltext as a  
whole.

>Try someothing like this:

>   get the htmltext of fld "A"
>   replace "" with empty in it
>   replace "" with empty in it
>   set the htmltext of fld "A" to it

>That should catch all instances regardless of where they are, and  
would

>be faster than using a repeat loop.


How I love this revTalk : there is always a smarter way to do it. I  
will test this out, only tomorrow I'll be out. So first thing monday  
morning.

Thanks, Jacqueline.

best, Beat Cornaz

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-03 Thread Richard Gaskin

DunbarX wrote:
The proffered scripts all necessitate that the original text, likely from a 
field, be manHandled word by word.


This is because text in a variable does not retain the textStyle of the 
source. But don't I remember that there is a way, or a gadget, that holds the 
style along with the raw text? The only reason it might matter is speed; a 
lot of getting and setting goes on in the solutions offered. It might be worth 
it to put massive amounts of text in a variable and process there, 
returning the new styled text to the field in one put.


Seems like I saw this somewhere...


As Jacque and others here have pointed out, htmlText is the 
highest-fidelity representation of field contents modifiable by script.


Dr. Raney said that if you ever find a way to do anything in a field 
which is not transferable to another field via htmlText it would be a bug.


Extra bonus points that htmlText is just plain text in a language 
designed for working with text easily.


HtmlText is the with-the-grain solution for modifying style runs in Rev.

Coming from a HC/SuperCard background I was initially prone to habits 
acquired with those other tools, but other tools don't have htmlText 
which Raney added to overcome the limitations of alternatives.


--
 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
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-03 Thread Paul Foraker
Beat,

The htmlText solution I proposed will also work for boxed text that is also
bold and underline:

Here is some text

You can simply replace the box tags with empty, leaving the underline and
bold. And, it will handle the spaces between words as well.

But, it sounds like you've got something that works for you.

Box is a little strange. Apparently, every style change results in a new,
additional box.

-- Paul
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-03 Thread J. Landman Gay

Beat Cornaz wrote:

Your script works as well as Devin's and also has the same 'shortcoming' 
of not removing the style between words.


I haven't tested it, but it seems to me that you don't need to iterate 
through any chunks at all if you replace the entire htmltext as a whole. 
Try someothing like this:


  get the htmltext of fld "A"
  replace "" with empty in it
  replace "" with empty in it
  set the htmltext of fld "A" to it

That should catch all instances regardless of where they are, and would 
be faster than using a repeat loop.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-03 Thread Beat Cornaz

>Devin wrote :
>repeat with i = 1 to the number of words in fld "thefield"
>   get the textStyle of word i of fld "thefield"
>   if it contains "bold" then
>replace "bold" with empty in it
> replace ",bold" with empty in it
> replace "bold," with empty in it
> set the textStyle of word i of fld "thefield" to it
>   end if
>end repeat

Thanks Devin, it works partly.
 First I added 2 lines which actually do the same as yours intended,  
but did not work (maybe I should have set the wholematches to true).
Anyway, the principle works in so far that sometimes I get 'mixed' as  
TextStyle (in case of 'link' text). I also need to come up with  
something for the empty spaces between the words. Sometimes the 'box'  
style (which I actually use instead of bold) does not get removed  
between words.


repeat with i = 1 to the number of words in fld "A"
   get the textStyle of word i of fld "A"
   if it contains "bold" then
 replace "bold" with empty in it
 if char 1 of it = comma then delete char 1 of it
  if char -1 of it = comma then delete char -1 of it
 set the textStyle of word i of fld "A" to it
   end if
end repeat

>Paul wrote :

I replaced 'bold' with 'box' as it also shows better if it has not  
been removed from the spaces between words


>repeat with i = 1 to the number of words in fld "A"
> get the textStyle of word i of fld "A"
> if it contains "box" then
>   replace "box" with "plain" in it
>   set the textStyle of word i of fld "A" to it
> end if
>end repeat

Your script works as well as Devin's and also has the same  
'shortcoming' of not removing the style between words.


I tried it out with checking and setting on character level. That  
works for 'bold', but it does NOT work for 'box'. The reason is that  
the textStyle returned from a char which is box and bold and  
underline is only box. So replacing 'box' with plain throws away the  
bold and underline as well.


The solution Devin offered is better in this respect. By replacing  
the 'box' with empty leaves the other style settings untouched  
(although they do not show up in the variable it).


So for the moment I will go for Devin's solution, but on a character  
level.


Thanks,

Beat
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-03 Thread Beat Cornaz

> Craig wrote :
>The proffered scripts all necessitate that the original text,  
likely from a

>field, be manHandled word by word.

>This is because text in a variable does not retain the textStyle of  
the
>source. But don't I remember that there is a way, or a gadget, that  
holds the
>style along with the raw text? The only reason it might matter is  
speed; a
>lot of getting and setting goes on in the solutions offered. It  
might be worth

>it to put massive amounts of text in a variable and process there,
>returning the new styled text to the field in one put.

>Seems like I saw this somewhere...


>then Paul wrote :

>This would be a way to follow Craig's suggestion:

  > put the htmlText of fld 1 into temp
   >replace "" with "" in temp
>   replace "" with "" in temp
 >  set the htmlText of fld 1 to temp


I didn't really think in the HTML direction, because speed in my case  
is of absolutely no importance. I guess the little pitfall I pointed  
out above also applies to this script. I was originally thinking of  
checking and setting the textStyle of each char (like Devin and Paul  
did on words level). Then I hoped there would be a cleaner way.


Cheers, Beat
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-02 Thread Paul Foraker
This would be a way to follow Craig's suggestion:

   put the htmlText of fld 1 into temp
   replace "" with "" in temp
   replace "" with "" in temp
   set the htmlText of fld 1 to temp

-- Paul

On Fri, Oct 2, 2009 at 3:39 PM,   wrote:
> The proffered scripts all necessitate that the original text, likely from a
> field, be manHandled word by word.
>
> This is because text in a variable does not retain the textStyle of the
> source. But don't I remember that there is a way, or a gadget, that holds the
> style along with the raw text? The only reason it might matter is speed; a
> lot of getting and setting goes on in the solutions offered. It might be worth
> it to put massive amounts of text in a variable and process there,
> returning the new styled text to the field in one put.
>
> Seems like I saw this somewhere...
>
> Craig Newman
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-02 Thread DunbarX
The proffered scripts all necessitate that the original text, likely from a 
field, be manHandled word by word.

This is because text in a variable does not retain the textStyle of the 
source. But don't I remember that there is a way, or a gadget, that holds the 
style along with the raw text? The only reason it might matter is speed; a 
lot of getting and setting goes on in the solutions offered. It might be worth 
it to put massive amounts of text in a variable and process there, 
returning the new styled text to the field in one put.

Seems like I saw this somewhere...

Craig Newman
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-02 Thread Paul Foraker
Riffing on Devin's:

repeat with i = 1 to the number of words in fld "thefield"
 get the textStyle of word i of fld "thefield"
 if it contains "bold" then
   replace "bold" with "plain" in it
   set the textStyle of word i of fld "thefield" to it
 end if
end repeat

-- Paul


On Fri, Oct 2, 2009 at 11:46 AM, Devin Asay  wrote:

>
> On Oct 2, 2009, at 12:26 PM, Beat Cornaz wrote:
>
>  Hi all,
>>
>> I have a field with text with different textStyles. Now I just want
>> to remove the bold (or any other) textStyle from that field. So
>> leaving all the underline, italic. box etc textStyle parts in order.
>>
>> set the textStyle of fld "X" to not bold   is accepted by the editor
>> but throws an error at runtime. Probably because not bold equals
>> false and you can't set a textStyle to false
>>
>> I could write a handler which checks the textStyle of every char and
>> removes the bold, but I guess there is a more easy way.
>>
>
> Beat,
>
> Try this (not tested):
>
> repeat with i = 1 to the number of words in fld "thefield"
>  get the textStyle of word i of fld "thefield"
>  if it contains "bold" then
>replace "bold" with empty in it
>replace ",bold" with empty in it
>replace "bold," with empty in it
>set the textStyle of word i of fld "thefield" to it
>  end if
> end repeat
>
> Something like this should work.
>
> Regards,
>
> Devin
>
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
>
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: set the textStyle to not bold

2009-10-02 Thread Devin Asay


On Oct 2, 2009, at 12:26 PM, Beat Cornaz wrote:


Hi all,

I have a field with text with different textStyles. Now I just want
to remove the bold (or any other) textStyle from that field. So
leaving all the underline, italic. box etc textStyle parts in order.

set the textStyle of fld "X" to not bold   is accepted by the editor
but throws an error at runtime. Probably because not bold equals
false and you can't set a textStyle to false

I could write a handler which checks the textStyle of every char and
removes the bold, but I guess there is a more easy way.


Beat,

Try this (not tested):

repeat with i = 1 to the number of words in fld "thefield"
  get the textStyle of word i of fld "thefield"
  if it contains "bold" then
replace "bold" with empty in it
replace ",bold" with empty in it
replace "bold," with empty in it
set the textStyle of word i of fld "thefield" to it
  end if
end repeat

Something like this should work.

Regards,

Devin


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


set the textStyle to not bold

2009-10-02 Thread Beat Cornaz

Hi all,

I have a field with text with different textStyles. Now I just want  
to remove the bold (or any other) textStyle from that field. So  
leaving all the underline, italic. box etc textStyle parts in order.


set the textStyle of fld "X" to not bold   is accepted by the editor  
but throws an error at runtime. Probably because not bold equals  
false and you can't set a textStyle to false


I could write a handler which checks the textStyle of every char and  
removes the bold, but I guess there is a more easy way.


Cheers, Beat

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution