conditional formatting, how to do it

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Jan 2 12:04:23 EST 2009


Bonsoir Peter,

Don't know if it will help, but:

Many times, it appears more efficient to set 'char 1 to -1 of line  
<line number> to <style>
So, in your case:

local tNum, tText
-----
lock screen
put 0 into tNum
put field "test" of stack "Calendar" into tText
repeat for each line tLine in tText
   if word 1 of tLine = "Sunday" then
     set the textStyle of char 1 to -1 of line tNum of field "test"  
of stack "Calendar" to "bold"
   end if
   add 1 to tNum
end repeat
unlock screen

Le 2 janv. 09 à 17:55, Peter Alcibiades a écrit :

> Must be doing something obvious wrong.  As usual!  I want to go  
> through a
> field and format lines depending on what they start with.
>
> So to begin with I try the following, which works just fine, to  
> make sure the
> lines are being found and picked up:
>
> set the itemDelimiter to " "
> repeat for each line theLine in field "test" of stack "Calendar"
> if item 1 of theLine is "Sunday" then
> put theLine
> end if
> end repeat
>
> Now I change this so as to do the formatting as follows:
>
> set the itemDelimiter to " "
> repeat for each line theLine in field "test" of stack "Calendar"
> if item 1 of theLine is "Sunday" then
> set the textStyle of theLine to "bold"
> end if
> end repeat
>
> and get the error
>
> Message execution error:
> Error description: Chunk: error in object expression
>
> So how to do this?  That is, make every line that starts with  
> Sunday bold?
> And why is it not working?

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list