Text style is hit or miss for me

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Text style is hit or miss for me

Richmond Mathewson via use-livecode
 I am attempting to add formatting buttons above a field.  If the text is
typed into the field, my formatting buttons work as expected.  When a user
pastes text from another application, my formatting works sometimes, but
not always.

Below is what I use in my Bold button, and Italic button. I want to keep
the style that is already applied, and add an additional style, for
example, if the selection is already bold, I want it to stay bold but add
italics.

set the textStyle of the selectedChunk to (the textStyle of the
selectedChunk) & "," & "bold"

set the textStyle of the selectedChunk to (the textStyle of the
selectedChunk) & "," & "italic"
How do you guys do formatting buttons?

~Roger
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text style is hit or miss for me

Richmond Mathewson via use-livecode
Hi Roger,

On 2017-07-07 16:36, Roger Eller via use-livecode wrote:
> How do you guys do formatting buttons?

Try

    set the textStyle["bold"] of the selectedChunk to true
    set the textStyle["italic"] of the selectedChunk to true

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text style is hit or miss for me

Richmond Mathewson via use-livecode
That worked perfectly for all but plain.  In my plain button, I had to
write it as:  set the textStyle of the selectedChunk to "plain".

Thank you, Mark!
~Roger


On Fri, Jul 7, 2017 at 10:40 AM, Mark Waddingham via use-livecode <
[hidden email]> wrote:

> Hi Roger,
>
> On 2017-07-07 16:36, Roger Eller via use-livecode wrote:
>
>> How do you guys do formatting buttons?
>>
>
> Try
>
>    set the textStyle["bold"] of the selectedChunk to true
>    set the textStyle["italic"] of the selectedChunk to true
>
> Warmest Regards,
>
> Mark.
>
> --
> Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text style is hit or miss for me

Richmond Mathewson via use-livecode
Roger,

The advantage of the array notation for textStyle is that you can explicitly set each style for a given run of text.

The disadvantage of the array notation for textStyle is that you have to explicitly un-set each style for a given run of text.  ;)

  set the textStyle[“bold”] of the selectedChunk to false

But as you note, if you want to clear out *all* style formatting, the old, non-array method of setting the textStyle to plain works great. Nuke those styles!

Devin


On Jul 7, 2017, at 8:59 AM, Roger Eller via use-livecode <[hidden email]<mailto:[hidden email]>> wrote:

That worked perfectly for all but plain.  In my plain button, I had to
write it as:  set the textStyle of the selectedChunk to "plain".

Thank you, Mark!
~Roger


On Fri, Jul 7, 2017 at 10:40 AM, Mark Waddingham via use-livecode <
[hidden email]<mailto:[hidden email]>> wrote:

Hi Roger,

On 2017-07-07 16:36, Roger Eller via use-livecode wrote:

How do you guys do formatting buttons?


Try

  set the textStyle["bold"] of the selectedChunk to true
  set the textStyle["italic"] of the selectedChunk to true

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email]<mailto:[hidden email]> ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]<mailto:[hidden email]>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Devin Asay
Director
Office of Digital Humanities
Brigham Young University

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