It worked as advertised, provided I also check for the instance of the given 
textStyle to be false, this works a charm. The code I need to show to my 
students is easy enough for them to understand, without the need to actually 
understand arrays. Thank you!

Best regards,
Tore

> 31. aug. 2018 kl. 22:00 skrev Mark Waddingham via use-livecode 
> <use-livecode@lists.runrev.com>:
> 
> On 2018-08-31 20:51, Tore Nilsen via use-livecode wrote:
>> I got a bit confused there. Pages behaves as you say, Microsoft Word
>> would turn off bold on the initial push of the button, then adding
>> bold to the styles the next time.
>> This is why I thought I needed to find the style of each word in a
>> group of words when the the textStyles is mixed. And I still think
>> that is what I need in order to mimic the behaviour of either Word or
>> Pages.
> 
> Okay - so - create a stack, create a field, type some text in it and then see 
> if you find that the Text > Bold/Italic/... items work as you find in 
> Pages/Word (you should, they seem to for me)...
> 
> If you find they work the same then:
> 
>  set the textStyle["bold"] of the selectedChunk to true -- "bold" can be 
> "italic" or any of the others, setting to false does the inverse
> 
> Is definitely what you need.
> 
> If the textStyle["bold"] of the selectedChunk is "mixed" it means some chars 
> are bold, some aren't - so you can make the appropriate decision as to what 
> to do based on your preference for either the Pages or Word behavior :)
> 
> Warmest Regards,
> 
> Mark.
> 
> P.S. The above feature was implemented a few versions ago precisely to allow 
> the functionality you describe to be implemented very easily... Prior to it, 
> the IDE menu items still did the right thing - but the code was, well, 
> nowhere near a single line...
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

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

Reply via email to