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 <justinc...@geniesolutions.com.au> > 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 **********************************************************************