Page 1 of 1

Adding multiple textstyle

Posted: Thu Sep 25, 2014 10:34 pm
by jalz
Hi Guys,

Im working on my data entry screen. I want to have four buttons to style my text, plain, bold, italics and underline. Each of the buttons has the following stype of code on the mouseup handler.

set the textStyle of the selectedChunk to "bold"

So when I highlight my text, and apply the bold button, the text as expected goes bold. Similarly when I select Italics, the highlighted text turns into italics.

What I want to also to do is if the selected text already has a style attached to it, I want to add another style to it. I've checked dictionary it looks like you can add a styleslist. The only thing is I don't know what delimiter I need to use for the styles list. I've got the following code below on my mouse up handler for the bold button. Can someone point me in the right direction please.


put the textStyle of the selectedChunk into tStyle
set the textStyle of the selectedChunk to "bold " & tStyle

Re: Adding multiple textstyle

Posted: Thu Sep 25, 2014 11:44 pm
by FourthWorld
For the last several versions, text styles can also be set using array notation to toggle each individually:

Code: Select all

set the textStyle["bold"] of word 1 of fld 1 to true
set the textStyle["italic"] of line 2 of fld 1 to false

Re: Adding multiple textstyle

Posted: Fri Sep 26, 2014 12:40 am
by dunbarx
Hi.

You can also do this in the clear:

set the textstyle of yourChunk to "italic,bold,box"

But I think what you want to do is to build compound textstyles onto chunks that may already have one. That is, if the third word is already "italic", and you press the "bold" button, the textstyle does not simply change to" bold", but rather to "italic,bold".

Is this so? If it is, you seem more than capable fo implementing it. You do not even need a custom property to hold the "history" of the existing style suite, since the "textStyle" property already does all that. Get going. Or ignore me if I am off base here.

EDIT: You already nearly did this above, I now see. You neglected to insert a comma, though. The syntax for a styleList is "style1,stlye2,style3,etc."

Craig Newman

Re: Adding multiple textstyle

Posted: Fri Sep 26, 2014 1:56 pm
by jalz
Hi Both,

Thanks Craig, that was exactly what I was looking for. I used the pipe delimiter and the space as a delimiter but should have used the comma!

All the best
Jalz

Re: Adding multiple textstyle

Posted: Fri Sep 26, 2014 2:06 pm
by Klaus
I used the pipe delimiter and the space as a delimiter but should have used the comma!
The dictionary does actually not leave any doubt about this! 8)