Missing function selectedWords/selectedTrueWords
Mark Waddingham
mark at livecode.com
Fri Aug 31 16:00:37 EDT 2018
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 ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list