Page 1 of 1

Formatting and Fields

Posted: Tue Jan 05, 2016 2:27 pm
by A1Qicks
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.

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 2:39 pm
by bn
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

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 3:09 pm
by Klaus
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

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 3:10 pm
by dunbarx
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

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 3:43 pm
by SparkOut
I can think of ending terrorism and world poverty. It can't do that on windows. Can we have feature parity please? ;)

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 5:09 pm
by bn
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

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 5:31 pm
by dunbarx
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

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 11:46 pm
by A1Qicks
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?

Re: Formatting and Fields

Posted: Tue Jan 05, 2016 11:58 pm
by dunbarx
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

Re: Formatting and Fields

Posted: Wed Jan 06, 2016 8:01 am
by SparkOut
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