LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
I'm trying to make a simple application that needs to apply basic text formatting to chunks within text in a field. I want to be able to select a word and then click a button to make that text go bold for example.
on mouseDown pMouseBtnNo
set the textStyle the selectedChunk of field "mText" to "bold"
end mouseDown
It doesn't work but I'm at a loss to see why.
Any pointers would be much appreciated.
Thanks
Phil
PS If you recognise the name it is because I got started with RR some time ago and then my priorities got changed for me. I'm back again having slid down the snake to square one.
So just write:
...
set the textStyle the selectedChunk to "bold"
...
and you are done Smile
throws an error. textStyle of the selectedChunk works as well. I only mentioned it as this forum is for newbies and these tiny specifics of grammar are often what catches us out. I didn't mean to sound ungrateful as I am very grateful for your advice.
Are you using a different version to me? I'm running 3.5.0-gm-1 and it does not seem to need "the".
I'm really struggling to get simple text format toggling to work and may just throw in the towel and use rrpHTMLToolbar.
How hard can it be to check the current status of the selectedchunk and then if it is say bold make it normal or the other way around? Also the lack of built in toggle buttons doesn't help.
well, I am using just another IDE: MetaCard, but the underlying engine is the SAME,
so differences should not appear at all?!?
Anyway, in my current project I have a text format palette and use checkboxes (with custom icons!)
to represent the state of "bold" and/or "italic" and manage this with something like this:
on selectionchanged
put the effective textfont of the selectedchunk into tCh
set the hiltite of btn "bold" to tCh caontains "bold"
set the hilite of btn "italic" to tCh contains "italic"
end selectionchanged