Write Pro beginner question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Write Pro beginner question

4D Tech mailing list
(First mail was truncated, so here I go again)


I am doing lots of work with 4D Write and really like it.

Now I am trying to take my first babysteps with 4D WritePro (V16.1).
Unfortunately I am falling down at each little step so far and need a grown-up to help me before I start crying really loud.

What I did a lot in 4D Write is to create documents/reports/etc. in methods, e.g.:

$lArea:=WR_InitArea
WR SET FONT ($lArea;"Lucida Grande")
WR SET TEXT PROPERTY ($lArea;wr font size;14)
WR INSERT TEXT ($lArea;"Title\r\r")
WR SET TEXT PROPERTY ($lArea;wr font size;12)
WR INSERT TEXT ($lArea;"Some plain text")
WR SET TEXT PROPERTY ($lArea;wr bold;1)
WR INSERT TEXT ($lArea;"Some bold text")
WR SET TEXT PROPERTY ($lArea;wr bold;0)
WR INSERT TEXT ($lArea;"Some more plain text")


First try in WritePro:

$oArea:=WP New
ST SET TEXT($oArea;"<SPAN STYLE='font-weight: bold'>Line 1\r</SPAN>";ST End text)
ST SET PLAIN TEXT($oArea;"Line 2";ST End text)

I would expect that gets me a document with "Line 1" in bold and "Line 2" in plain.
What it actually does is giving me 2 bold lines.
What am I doing wrong?

text-decoration: underline is not working at all.

Next question:
How do I set up a default font size and style?
Or do I really have to tell WP all those information with every SET TEXT command?
That seems overly complicated.

I read through the sparse documentation for hours but that confuses me more than it helps.

Thanks for any hints.

Greetings from Germany,
Bernd Fröhlich
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Write Pro beginner question

4D Tech mailing list
Please don't cry, Bernd :)
I think you have slightly misunderstood ST SET PLAIN TEXT. In this context
PLAIN TEXT means *unformatted*, rather than *unstyled*. In other words, ST
SET PLAIN TEXT inserts text into whatever styling is already in place. So
to remove the bold, you would need to change the style.

I would liken it to using Style Sheets in a regular word processing
program. You've applied a style to some text, and then you've added more
text without changing the style.

I am still trying to get my head around the way 4D Write Pro handles text
styling. Take a look at Bookmarks
http://doc.4d.com/4Dv16/4D/16/Accessing-document-contents-by-programming.300-3051923.en.html
and Attributes
http://doc.4d.com/4Dv16/4D/16/WP-SET-ATTRIBUTES.301-3048101.en.html

HTH
Pat

On 29 May 2017 at 16:18, Bernd Fröhlich via 4D_Tech <[hidden email]>
wrote:

> (First mail was truncated, so here I go again)
>
>
> I am doing lots of work with 4D Write and really like it.
>
> Now I am trying to take my first babysteps with 4D WritePro (V16.1).
> Unfortunately I am falling down at each little step so far and need a
> grown-up to help me before I start crying really loud.
>
> What I did a lot in 4D Write is to create documents/reports/etc. in
> methods, e.g.:
>
> $lArea:=WR_InitArea
> WR SET FONT ($lArea;"Lucida Grande")
> WR SET TEXT PROPERTY ($lArea;wr font size;14)
> WR INSERT TEXT ($lArea;"Title\r\r")
> WR SET TEXT PROPERTY ($lArea;wr font size;12)
> WR INSERT TEXT ($lArea;"Some plain text")
> WR SET TEXT PROPERTY ($lArea;wr bold;1)
> WR INSERT TEXT ($lArea;"Some bold text")
> WR SET TEXT PROPERTY ($lArea;wr bold;0)
> WR INSERT TEXT ($lArea;"Some more plain text")
>
>
> First try in WritePro:
>
> $oArea:=WP New
> ST SET TEXT($oArea;"<SPAN STYLE='font-weight: bold'>Line 1\r</SPAN>";ST
> End text)
> ST SET PLAIN TEXT($oArea;"Line 2";ST End text)
>
> I would expect that gets me a document with "Line 1" in bold and "Line 2"
> in plain.
> What it actually does is giving me 2 bold lines.
> What am I doing wrong?
>
> text-decoration: underline is not working at all.
>
> Next question:
> How do I set up a default font size and style?
> Or do I really have to tell WP all those information with every SET TEXT
> command?
> That seems overly complicated.
>
> I read through the sparse documentation for hours but that confuses me
> more than it helps.
>
> Thanks for any hints.
>
> Greetings from Germany,
> Bernd Fröhlich
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************




--
*************************************************
CatBase - The Database Publishing Solution
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Write Pro beginner question

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Pat Bensky:

> Please don't cry, Bernd :)
> I think you have slightly misunderstood ST SET PLAIN TEXT. In this context
> PLAIN TEXT means *unformatted*, rather than *unstyled*. In other words, ST
> SET PLAIN TEXT inserts text into whatever styling is already in place. So
> to remove the bold, you would need to change the style.
>
> I would liken it to using Style Sheets in a regular word processing
> program. You've applied a style to some text, and then you've added more
> text without changing the style.
>
> I am still trying to get my head around the way 4D Write Pro handles text
> styling. Take a look at Bookmarks
> http://doc.4d.com/4Dv16/4D/16/Accessing-document-contents-by-programming.300-3051923.en.html
> and Attributes
> http://doc.4d.com/4Dv16/4D/16/WP-SET-ATTRIBUTES.301-3048101.en.html


Thanks for the help and the links Pat.
I´m very slowly beginning to understand the concepts used by WritePro.

In 4D Write I could just set all the attributes to my liking and then insert my text.

In WritePro I have to insert the text, select the inserted text and then apply attributes.
Seems all very backwards to me.
Takes about double the lines of code and is four times as hard to understand (at least for me).

Well, I guess I will have to get used to it.

Greetings from Germany,
Bernd Fröhlich
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************