formatting text
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
formatting text
Your help please, would be greatly appreciated!
From a number of text fields I wish to build up a single document.
The main document might be built up in this way.
Item heading 1
Some descriptive text here from another variable in plain format.
Item heading 2
Some MORE descriptive text here from another variable in plain format.
and so on......
Whatever I try, I end up with either all bold and underlined
OR
plain text
but not bold underlined headings with plain text to follow.
There are no constant positions for the headings or set text length or content. They are derived from calculation elsewhere.
Code used:
global Secondary
put empty into field "tmptext"
put empty into field "transf"
put empty into ConstructionSummary
set the textstyle of field "tmptext" to "underline, bold"
set the textstyle of field "transf" to "plain"
put "Main Heating system " into field "tmptext"
put BoilerText into field "transf"
put field "tmptext" & return & field "transf" into ConstructionSummary
put "Heat emitters " into field "tmptext"
put EmitterTxt into field "transf"
put ConstructionSummary & return & field "tmptext" & return & field "transf" into ConstructionSummary
put "Secondary Heating system" into field "tmptext"
put Secondary into field "transf"
put ConstructionSummary & return & field "tmptext" & return & field "transf" into ConstructionSummary
put ConstructionSummary into field "tmptext"
From a number of text fields I wish to build up a single document.
The main document might be built up in this way.
Item heading 1
Some descriptive text here from another variable in plain format.
Item heading 2
Some MORE descriptive text here from another variable in plain format.
and so on......
Whatever I try, I end up with either all bold and underlined
OR
plain text
but not bold underlined headings with plain text to follow.
There are no constant positions for the headings or set text length or content. They are derived from calculation elsewhere.
Code used:
global Secondary
put empty into field "tmptext"
put empty into field "transf"
put empty into ConstructionSummary
set the textstyle of field "tmptext" to "underline, bold"
set the textstyle of field "transf" to "plain"
put "Main Heating system " into field "tmptext"
put BoilerText into field "transf"
put field "tmptext" & return & field "transf" into ConstructionSummary
put "Heat emitters " into field "tmptext"
put EmitterTxt into field "transf"
put ConstructionSummary & return & field "tmptext" & return & field "transf" into ConstructionSummary
put "Secondary Heating system" into field "tmptext"
put Secondary into field "transf"
put ConstructionSummary & return & field "tmptext" & return & field "transf" into ConstructionSummary
put ConstructionSummary into field "tmptext"
Hi user,
What about something like:
set the htmlText of fld A to (the htmlText of fld x & the htmlText of fld y & the htmlText of fld z)
Best,
Mark
What about something like:
set the htmlText of fld A to (the htmlText of fld x & the htmlText of fld y & the htmlText of fld z)
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Hi user#606,
in a quick test, this does work for me, collecting all the HTMLtext in one variable:
Best
Klaus
in a quick test, this does work for me, collecting all the HTMLtext in one variable:
Code: Select all
on mouseUp
put the htmltext of fld 1 & CR & the htmltext of fld 2 into harold
set the htmltext of fld 3 to harold
end mouseUp
Klaus
User,
Your script moves text around and leaves behind any text styles. The "put" command only deals with plain text. There is no way for your script to preserve text styles. Try using the htmlText again and if it doesn't work, please post your script here.
Best,
Mark
Your script moves text around and leaves behind any text styles. The "put" command only deals with plain text. There is no way for your script to preserve text styles. Try using the htmlText again and if it doesn't work, please post your script here.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Hi Mark,
I have tried the suggestion from Klous, but, you are right, it is plain text with text styles.
<p><p><p></p></p></p>
<p><p><p>Main Heating system </p></p></p>
<p><p><p>Natural gas, Condencing, Combi boiler with fan assisted balanced flue and auto ignition, having a
It appears odd to me that such a simple and probably typical way of building up headed paragraphs is so problematic.
the complete code is:
ON mouseUp
local filepath
global ConstructionSummary
global CylHeatSpace, CylinderSpec
global BoilerText
global SizeFlag
global BoilerChoice
global LPGflag
global EmitterTxt
global Cylinder
global Secondary
put empty into field "tmptext"
put empty into field "transf"
put empty into ConstructionSummary
put empty into field "ConstructionSummary"
set the textstyle of field "tmptext" to "underline, bold"
set the textstyle of field "transf" to "plain"
put "Main Heating system " into field "tmptext"
put BoilerText into field "transf"
put the htmltext of field "ConstructionSummary" & return & the htmltext of field "tmptext" & return & the htmltext of field "transf" into field "ConstructionSummary"
put "Heat emitters " into field "tmptext"
put EmitterTxt into field "transf"
put the htmltext of field "ConstructionSummary" & return & the htmltext of field "tmptext" & return & the htmltext of field "transf" into field "ConstructionSummary"
put "Secondary Heating system" into field "tmptext"
put Secondary into field "transf"
put the htmltext of field "ConstructionSummary" & return & the htmltext of field "tmptext" & return & the htmltext of field "transf" into field "ConstructionSummary"
put field "ConstructionSummary" into field "tmptext"
go to card id 1087
END mouseUp
--put the htmltext of fld 1 & CR & the htmltext of fld 2 into harold
--set the htmltext of fld 3 to harold
I have tried the suggestion from Klous, but, you are right, it is plain text with text styles.
<p><p><p></p></p></p>
<p><p><p>Main Heating system </p></p></p>
<p><p><p>Natural gas, Condencing, Combi boiler with fan assisted balanced flue and auto ignition, having a
It appears odd to me that such a simple and probably typical way of building up headed paragraphs is so problematic.
the complete code is:
ON mouseUp
local filepath
global ConstructionSummary
global CylHeatSpace, CylinderSpec
global BoilerText
global SizeFlag
global BoilerChoice
global LPGflag
global EmitterTxt
global Cylinder
global Secondary
put empty into field "tmptext"
put empty into field "transf"
put empty into ConstructionSummary
put empty into field "ConstructionSummary"
set the textstyle of field "tmptext" to "underline, bold"
set the textstyle of field "transf" to "plain"
put "Main Heating system " into field "tmptext"
put BoilerText into field "transf"
put the htmltext of field "ConstructionSummary" & return & the htmltext of field "tmptext" & return & the htmltext of field "transf" into field "ConstructionSummary"
put "Heat emitters " into field "tmptext"
put EmitterTxt into field "transf"
put the htmltext of field "ConstructionSummary" & return & the htmltext of field "tmptext" & return & the htmltext of field "transf" into field "ConstructionSummary"
put "Secondary Heating system" into field "tmptext"
put Secondary into field "transf"
put the htmltext of field "ConstructionSummary" & return & the htmltext of field "tmptext" & return & the htmltext of field "transf" into field "ConstructionSummary"
put field "ConstructionSummary" into field "tmptext"
go to card id 1087
END mouseUp
--put the htmltext of fld 1 & CR & the htmltext of fld 2 into harold
--set the htmltext of fld 3 to harold
Dear User,
Please read the information about htmlText in the docs. I can't possibly explain it better.
Whenever you put text into a field, you get plain text. After doing so, you must set the textStyle of char a to b of fld X to whatever style you want. Setting the textStyle of a field doesn't change the text itself and setting the textStyle of a text before putting the text into the field... well... just doesn't make any sense. Make sure to read about the textStyle property in the docs as well.
Best,
Mark
Please read the information about htmlText in the docs. I can't possibly explain it better.
Whenever you put text into a field, you get plain text. After doing so, you must set the textStyle of char a to b of fld X to whatever style you want. Setting the textStyle of a field doesn't change the text itself and setting the textStyle of a text before putting the text into the field... well... just doesn't make any sense. Make sure to read about the textStyle property in the docs as well.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Mark,
What you say appears to be the reality of the situation, however something is odd here.
If you look at the contents of a field variable, you can actually select some of it and set its properties to BOLD, for example. When displayed, those properties remain, even if more text is added (albeit plain).
My requirement is so basic to any language, that I cannot believe it cannot be done as I want without complex string manipulation.
What you say appears to be the reality of the situation, however something is odd here.
If you look at the contents of a field variable, you can actually select some of it and set its properties to BOLD, for example. When displayed, those properties remain, even if more text is added (albeit plain).
My requirement is so basic to any language, that I cannot believe it cannot be done as I want without complex string manipulation.
Hi User,
If a field already contains text, you can put plain text after it, using
put "some text" after fld x
This will preserve already existing text properties.
If you want something else, you need to apply a little bit of very simple text manipulation. Fact is, as long as you're not using unicode, this works much simpler than with most other languages.
Best,
Mark
If a field already contains text, you can put plain text after it, using
put "some text" after fld x
This will preserve already existing text properties.
If you want something else, you need to apply a little bit of very simple text manipulation. Fact is, as long as you're not using unicode, this works much simpler than with most other languages.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode