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 <pben...@gmail.com> > > 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 **********************************************************************