Formatting and Fields

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Formatting and Fields

Post by A1Qicks » Tue Jan 05, 2016 2:27 pm

Is it possible within LiveCode to have different formatting for text within a field? I don't currently see any way of doing so and thus am led to believe that you can't, though equally it seems like a basic thing to be able to set one line of text to be bold and then the next to be italic, or some such.

Otherwise I'm going to have to create multiple fields and find some way to make one line up with another just to have multiple formats, and that's about ten times as much work as it seems like it should be.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Formatting and Fields

Post by bn » Tue Jan 05, 2016 2:39 pm

Hi,

look up "textstyle" in the dictionary.

Also here is a link to a sample stack with formatting options introduce in LC 5.5

http://forums.livecode.com/viewtopic.php?f=7&t=11686

it is an attachement to the second post.

If you have more specific questions feel free to ask

Kind regards
Bernd

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Formatting and Fields

Post by Klaus » Tue Jan 05, 2016 3:09 pm

Hi,

the dictionary has entries for "bold" and also "italic" with examples like:
...
set the textStyle of button "Label" to bold
...
So please dare to always use the dictionary first, it is really better than its reputation! 8)


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Formatting and Fields

Post by dunbarx » Tue Jan 05, 2016 3:10 pm

Take five minutes. Trust me.

On a new card, make a button and a field. In the field, place three visible short lines of text. Anything will do. In the button script:

Code: Select all

on mouseUp
   repeat 10
      set the textStyle of line random(3) of fld 1 to any item of "bold,plain,italic"
      wait 10
      set the textSize of line random(3) of fld 1 to any item of "9,12,18"
      wait 10
      set the textColor of line random(3) of fld 1 to any item of "red,orange,blue"
      wait 10
   end repeat
end mouseUp
LiveCode can do anything you can think of.

Craig Newman

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Formatting and Fields

Post by SparkOut » Tue Jan 05, 2016 3:43 pm

I can think of ending terrorism and world poverty. It can't do that on windows. Can we have feature parity please? ;)

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Formatting and Fields

Post by bn » Tue Jan 05, 2016 5:09 pm

Hi Sparkout,
I can think of ending terrorism and world poverty
you should use a different spelling checker:

it guess you meant:
I can think of ending tenorism and word poverty
That can be done on any platform, even operas...

Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Formatting and Fields

Post by dunbarx » Tue Jan 05, 2016 5:31 pm

If all terrorists spent their time making fun stacks instead of contemplating murder, then LC would have solved that problem.

The poverty thing is dicier.

Craig

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: Formatting and Fields

Post by A1Qicks » Tue Jan 05, 2016 11:46 pm

Thanks for the help, guys, but I'm getting a "can't find" error "near 'Terrorists'":

on SolveWorld
put 0 into Poverty
put 0 into Terrorists
end SolveWorld

Somehow I don't think we can solve this one from here. Maybe with a missile Array?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Formatting and Fields

Post by dunbarx » Tue Jan 05, 2016 11:58 pm

I don't get a compile-time error with your handler, but it doesn't seem to do anything. Maybe the variables are weakly typed?

Craig

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Formatting and Fields

Post by SparkOut » Wed Jan 06, 2016 8:01 am

Maybe we should make them custom properties

Code: Select all

on solveWorld
  set the uPoverty of this planet to false
  set the uTerrorism of this planet to false
end solveWorld

Post Reply