Re: Write Pro: programmatically manipulate text expertise needed

2018-06-21 Thread Justin Carr via 4D_Tech
On 21 Jun 2018, at 4:49 pm, Piotr Chabot Stadhouders via 4D_Tech 
<4d_tech@lists.4d.com> wrote:
> 
> Hi Justin, Pat,
> 
> Using WP SELECT that is called in a method via CALL FORM seems to work, 
> thanks for that!
> 
> I must say, I can't believe it's 4D's intention that we constantly have to 
> use CALL FORM for thinks to work.
> Maybe they implement a more sophisticated way for doing this.

I have to say it's annoying. What's even more annoying is that most of the time 
CALL FORM isn't enough. You have to use SET TIMER(-1) and set some info 
somewhere to let the timer know what to do when it triggers. I don't find it 
anwhere near as simple or intuitive as working with 4D Write was. I live in 
hope that things will become easier to manage as the product improves. 
Certainly there are steps forward with each new release.

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Write Pro: programmatically manipulate text expertise needed

2018-06-20 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi Justin, Pat,

Using WP SELECT that is called in a method via CALL FORM seems to work, thanks 
for that!

I must say, I can't believe it's 4D's intention that we constantly have to use 
CALL FORM for thinks to work.
Maybe they implement a more sophisticated way for doing this.

Thanks again,

Piotr

> -Oorspronkelijk bericht-
> Van: Justin Carr 
> Verzonden: maandag 18 juni 2018 5:00
> Aan: 4D iNug Technical <4d_tech@lists.4d.com>
> Onderwerp: Re: Write Pro: programmatically manipulate text expertise needed
> 
> On 15 Jun 2018, at 10:01 pm, Pat Bensky via 4D_Tech <4d_tech@lists.4d.com>
> wrote:
> >
> > Hi Piotr,
> > I think you can use WP SELECT to do this - WP SELECT ( {* ;} wpArea {;
> > targetObj} | {; startRange ; endRange} )
> >
> > Let me know if you can't get that to work and I'll take a closer look at it.
> >
> > HTH
> >
> > Pat
> >
> > On Wed, 13 Jun 2018 at 07:35, Piotr Chabot Stadhouders via 4D_Tech <
> > 4d_tech@lists.4d.com> wrote:
> >
> >> Hi Pat,
> >>
> >> Your tips seem to work, but I am hoping you also know the answer to
> >> the next problem.
> >> See example 1 : After replacing the text with ST SET
> >> TEXT($wp_obj;$text;$start_pos;$end_pos) the cursor must be set after
> >> the last inserted character. This replacing is done in the On After
> >> Keystroke event of the Write Pro area and is triggered when the user types 
> >> a
> space.
> >> However, I don't succeed in setting the cursor at the end of the
> >> inserted text, it stays at the position where it was (position after
> >> the original
> >> space)
> >>
> >> Do you also have a tip how to set the cursor to a different position
> >> in the "On After Keystroke" event of the Pro Area?
> 
> WP SELECT is the way to go but, like many things in 4D Write Pro, you need to
> do it in a separate execution cycle (from the ST SET TEXT).
> 
> CALL FORM will work in this instance (it doesn't work in most of the instances
> where 4D Write Pro needs to complete the current execution cycle before any
> new changes can be applied).
> 
> So, have a separate method to which you pass your 4D Write Pro object and
> your $endpos and run the WP SELECT from there. Call the method after your ST
> SET TEXT using CALL FORM.
> 
> J
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Write Pro: programmatically manipulate text expertise needed

2018-06-17 Thread Justin Carr via 4D_Tech
On 15 Jun 2018, at 10:01 pm, Pat Bensky via 4D_Tech <4d_tech@lists.4d.com> 
wrote:
> 
> Hi Piotr,
> I think you can use WP SELECT to do this -
> WP SELECT ( {* ;} wpArea {; targetObj} | {; startRange ; endRange} )
> 
> Let me know if you can't get that to work and I'll take a closer look at it.
> 
> HTH
> 
> Pat
> 
> On Wed, 13 Jun 2018 at 07:35, Piotr Chabot Stadhouders via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> Hi Pat,
>> 
>> Your tips seem to work, but I am hoping you also know the answer to the
>> next problem.
>> See example 1 : After replacing the text with ST SET
>> TEXT($wp_obj;$text;$start_pos;$end_pos) the cursor must be set after the
>> last inserted character. This replacing is done in the On After Keystroke
>> event of the Write Pro area and is triggered when the user types a space.
>> However, I don't succeed in setting the cursor at the end of the inserted
>> text, it stays at the position where it was (position after the original
>> space)
>> 
>> Do you also have a tip how to set the cursor to a different position in
>> the "On After Keystroke" event of the Pro Area?

WP SELECT is the way to go but, like many things in 4D Write Pro, you need to 
do it in a separate execution cycle (from the ST SET TEXT).

CALL FORM will work in this instance (it doesn't work in most of the instances 
where 4D Write Pro needs to complete the current execution cycle before any new 
changes can be applied).

So, have a separate method to which you pass your 4D Write Pro object and your 
$endpos and run the WP SELECT from there. Call the method after your ST SET 
TEXT using CALL FORM.

J
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Write Pro: programmatically manipulate text expertise needed

2018-06-15 Thread Pat Bensky via 4D_Tech
Hi Piotr,
I think you can use WP SELECT to do this -
WP SELECT ( {* ;} wpArea {; targetObj} | {; startRange ; endRange} )

Let me know if you can't get that to work and I'll take a closer look at it.

HTH

Pat

On Wed, 13 Jun 2018 at 07:35, Piotr Chabot Stadhouders via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi Pat,
>
> Your tips seem to work, but I am hoping you also know the answer to the
> next problem.
> See example 1 : After replacing the text with ST SET
> TEXT($wp_obj;$text;$start_pos;$end_pos) the cursor must be set after the
> last inserted character. This replacing is done in the On After Keystroke
> event of the Write Pro area and is triggered when the user types a space.
> However, I don't succeed in setting the cursor at the end of the inserted
> text, it stays at the position where it was (position after the original
> space)
>
> Do you also have a tip how to set the cursor to a different position in
> the "On After Keystroke" event of the Pro Area?
>
> Thanks,
>
> Piotr
>
>
> > -Oorspronkelijk bericht-
> > Van: Pat Bensky 
> > Verzonden: dinsdag 12 juni 2018 13:40
> > Aan: 4D iNug Technical <4d_tech@lists.4d.com>
> > Onderwerp: Re: Write Pro: programmatically manipulate text expertise
> needed
> >
> > Piotr,
> > 1. I think you will need to use ST GET PLAIN TEXT to get all the text
> after the
> > specified range and then look for the first return character in that
> selection. I
> > believe this is the only way to get an accurate position with styled
> text.
> >
> > 2. Again, use ST GET PLAIN TEXT to get a range of text from the cursor
> position
> > back n characters or to the beginning of the text.
> >
> > HTH
> >
> > Pat
> >
> > On Tue, 12 Jun 2018 at 10:02, Piotr Chabot Stadhouders via 4D_Tech <
> > 4d_tech@lists.4d.com> wrote:
> >
> > > Hi all,
> > >
> > > We are in the progress of migrating from 4D Write to Write Pro A lot
> > > of things are going fine, but there is one area that seems easy but I
> > > am having difficulties with it and that is programmatically
> > > manipulating text
> > >
> > > I give 2 examples that maybe seem obvious to others but are not for me:
> > >
> > >   1.  I am in a procedure where I have an Write Pro object (not perce
> > > an area on screen, could be a range) and an expression has been
> > > selected via $type:=ST Get content
> > > type($wp_obj;$start;$end;$startBlock;$endBlock). I call the command ST
> > > SET TEXT($wp_obj;$text;$startBlock;$endBlock) to replace the selected
> > expression. So far no problems, but here it comes...
> > > Now I want to find the first occurrence of a carriage return in the
> > > text that comes after the replaced text (end inserted text - end whole
> text).
> > > What is the best / easiest way to do this? Remember, this text can
> > > contain styled text and/or expressions and/or pictures
> > >   2.  Example 2 is like example 1 but now with an actual visual area.
> > > The user types a couple of characters. At a certain point after typing
> > > I want to procedurally replace the typed text from the cursor back
> > > until the first space and replace it with another text. Maybe somebody
> > > knows "Type it for me", this is what I am talking about. So, what is
> > > the best way to find the first occurrence of a space from the cursor
> > > back and replace this text with another text?
> > >
> > > Thanks in advance,
> > >
> > > Piotr
> > >
> > >
> > 
> > **
> > > 4D Internet Users Group (4D iNUG)
> > > FAQ:  http://lists.4d.com/faqnug.html
> > > Archive:  http://lists.4d.com/archives.html
> > > Options: https://lists.4d.com/mailman/options/4d_tech
> > > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > >
> > 
> > **
> >
> >
> >
> > --
> > *
> > CatBase - Top Dog in Data Publishing
> > 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: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Write Pro: programmatically manipulate text expertise needed

2018-06-12 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi Pat,

Your tips seem to work, but I am hoping you also know the answer to the next 
problem.
See example 1 : After replacing the text with ST SET 
TEXT($wp_obj;$text;$start_pos;$end_pos) the cursor must be set after the last 
inserted character. This replacing is done in the On After Keystroke event of 
the Write Pro area and is triggered when the user types a space. However, I 
don't succeed in setting the cursor at the end of the inserted text, it stays 
at the position where it was (position after the original space)

Do you also have a tip how to set the cursor to a different position in the "On 
After Keystroke" event of the Pro Area?

Thanks,

Piotr


> -Oorspronkelijk bericht-
> Van: Pat Bensky 
> Verzonden: dinsdag 12 juni 2018 13:40
> Aan: 4D iNug Technical <4d_tech@lists.4d.com>
> Onderwerp: Re: Write Pro: programmatically manipulate text expertise needed
> 
> Piotr,
> 1. I think you will need to use ST GET PLAIN TEXT to get all the text after 
> the
> specified range and then look for the first return character in that 
> selection. I
> believe this is the only way to get an accurate position with styled text.
> 
> 2. Again, use ST GET PLAIN TEXT to get a range of text from the cursor 
> position
> back n characters or to the beginning of the text.
> 
> HTH
> 
> Pat
> 
> On Tue, 12 Jun 2018 at 10:02, Piotr Chabot Stadhouders via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
> > Hi all,
> >
> > We are in the progress of migrating from 4D Write to Write Pro A lot
> > of things are going fine, but there is one area that seems easy but I
> > am having difficulties with it and that is programmatically
> > manipulating text
> >
> > I give 2 examples that maybe seem obvious to others but are not for me:
> >
> >   1.  I am in a procedure where I have an Write Pro object (not perce
> > an area on screen, could be a range) and an expression has been
> > selected via $type:=ST Get content
> > type($wp_obj;$start;$end;$startBlock;$endBlock). I call the command ST
> > SET TEXT($wp_obj;$text;$startBlock;$endBlock) to replace the selected
> expression. So far no problems, but here it comes...
> > Now I want to find the first occurrence of a carriage return in the
> > text that comes after the replaced text (end inserted text - end whole 
> > text).
> > What is the best / easiest way to do this? Remember, this text can
> > contain styled text and/or expressions and/or pictures
> >   2.  Example 2 is like example 1 but now with an actual visual area.
> > The user types a couple of characters. At a certain point after typing
> > I want to procedurally replace the typed text from the cursor back
> > until the first space and replace it with another text. Maybe somebody
> > knows "Type it for me", this is what I am talking about. So, what is
> > the best way to find the first occurrence of a space from the cursor
> > back and replace this text with another text?
> >
> > Thanks in advance,
> >
> > Piotr
> >
> >
> 
> **
> > 4D Internet Users Group (4D iNUG)
> > FAQ:  http://lists.4d.com/faqnug.html
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> >
> 
> **
> 
> 
> 
> --
> *
> CatBase - Top Dog in Data Publishing
> 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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Write Pro: programmatically manipulate text expertise needed

2018-06-12 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi Pat,

Thanks for your answer.

Sometimes the solution is quite obvious but you just don't see it๐Ÿ˜Š

Gr,

Piotr

> -Oorspronkelijk bericht-
> Van: Pat Bensky 
> Verzonden: dinsdag 12 juni 2018 13:40
> Aan: 4D iNug Technical <4d_tech@lists.4d.com>
> Onderwerp: Re: Write Pro: programmatically manipulate text expertise needed
> 
> Piotr,
> 1. I think you will need to use ST GET PLAIN TEXT to get all the text after 
> the
> specified range and then look for the first return character in that 
> selection. I
> believe this is the only way to get an accurate position with styled text.
> 
> 2. Again, use ST GET PLAIN TEXT to get a range of text from the cursor 
> position
> back n characters or to the beginning of the text.
> 
> HTH
> 
> Pat
> 
> On Tue, 12 Jun 2018 at 10:02, Piotr Chabot Stadhouders via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
> > Hi all,
> >
> > We are in the progress of migrating from 4D Write to Write Pro A lot
> > of things are going fine, but there is one area that seems easy but I
> > am having difficulties with it and that is programmatically
> > manipulating text
> >
> > I give 2 examples that maybe seem obvious to others but are not for me:
> >
> >   1.  I am in a procedure where I have an Write Pro object (not perce
> > an area on screen, could be a range) and an expression has been
> > selected via $type:=ST Get content
> > type($wp_obj;$start;$end;$startBlock;$endBlock). I call the command ST
> > SET TEXT($wp_obj;$text;$startBlock;$endBlock) to replace the selected
> expression. So far no problems, but here it comes...
> > Now I want to find the first occurrence of a carriage return in the
> > text that comes after the replaced text (end inserted text - end whole 
> > text).
> > What is the best / easiest way to do this? Remember, this text can
> > contain styled text and/or expressions and/or pictures
> >   2.  Example 2 is like example 1 but now with an actual visual area.
> > The user types a couple of characters. At a certain point after typing
> > I want to procedurally replace the typed text from the cursor back
> > until the first space and replace it with another text. Maybe somebody
> > knows "Type it for me", this is what I am talking about. So, what is
> > the best way to find the first occurrence of a space from the cursor
> > back and replace this text with another text?
> >
> > Thanks in advance,
> >
> > Piotr
> >
> >
> 
> **
> > 4D Internet Users Group (4D iNUG)
> > FAQ:  http://lists.4d.com/faqnug.html
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> >
> 
> **
> 
> 
> 
> --
> *
> CatBase - Top Dog in Data Publishing
> 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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Write Pro: programmatically manipulate text expertise needed

2018-06-12 Thread Pat Bensky via 4D_Tech
Piotr,
1. I think you will need to use ST GET PLAIN TEXT to get all the text after
the specified range and then look for the first return character in that
selection. I believe this is the only way to get an accurate position with
styled text.

2. Again, use ST GET PLAIN TEXT to get a range of text from the cursor
position back n characters or to the beginning of the text.

HTH

Pat

On Tue, 12 Jun 2018 at 10:02, Piotr Chabot Stadhouders via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi all,
>
> We are in the progress of migrating from 4D Write to Write Pro
> A lot of things are going fine, but there is one area that seems easy but
> I am having difficulties with it and that is programmatically manipulating
> text
>
> I give 2 examples that maybe seem obvious to others but are not for me:
>
>   1.  I am in a procedure where I have an Write Pro object (not perce an
> area on screen, could be a range) and an expression has been selected via
> $type:=ST Get content type($wp_obj;$start;$end;$startBlock;$endBlock). I
> call the command ST SET TEXT($wp_obj;$text;$startBlock;$endBlock) to
> replace the selected expression. So far no problems, but here it comes...
> Now I want to find the first occurrence of a carriage return in the text
> that comes after the replaced text (end inserted text - end whole text).
> What is the best / easiest way to do this? Remember, this text can contain
> styled text and/or expressions and/or pictures
>   2.  Example 2 is like example 1 but now with an actual visual area. The
> user types a couple of characters. At a certain point after typing I want
> to procedurally replace the typed text from the cursor back until the first
> space and replace it with another text. Maybe somebody knows "Type it for
> me", this is what I am talking about. So, what is the best way to find the
> first occurrence of a space from the cursor back and replace this text with
> another text?
>
> Thanks in advance,
>
> Piotr
>
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
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: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Write Pro: programmatically manipulate text expertise needed

2018-06-12 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi all,

We are in the progress of migrating from 4D Write to Write Pro
A lot of things are going fine, but there is one area that seems easy but I am 
having difficulties with it and that is programmatically manipulating text

I give 2 examples that maybe seem obvious to others but are not for me:

  1.  I am in a procedure where I have an Write Pro object (not perce an area 
on screen, could be a range) and an expression has been selected via $type:=ST 
Get content type($wp_obj;$start;$end;$startBlock;$endBlock). I call the command 
ST SET TEXT($wp_obj;$text;$startBlock;$endBlock) to replace the selected 
expression. So far no problems, but here it comes... Now I want to find the 
first occurrence of a carriage return in the text that comes after the replaced 
text (end inserted text - end whole text). What is the best / easiest way to do 
this? Remember, this text can contain styled text and/or expressions and/or 
pictures
  2.  Example 2 is like example 1 but now with an actual visual area. The user 
types a couple of characters. At a certain point after typing I want to 
procedurally replace the typed text from the cursor back until the first space 
and replace it with another text. Maybe somebody knows "Type it for me", this 
is what I am talking about. So, what is the best way to find the first 
occurrence of a space from the cursor back and replace this text with another 
text?

Thanks in advance,

Piotr

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**