WPCubed Product Support

Descrease/remove number/bullet level on backspace

I am trying to get wprichtext to work like Word when a user backspaces at the start of a numbered or bulleted paragraph. And also with an indented para. I am not getting very far!

Code so far:

if key=vk_back then
    begin
      if (wprichtext1.Textcursor.active_posinpar=0) and (wpRichText1.activepar.isNumbered) then 
        begin
          key:=0;
          wpRichText1.AGet(WPAT_NumberLevel, val);
          wpRichText1.ASet(WPAT_NumberSTYLE, 0);
          wpRichText1.ASet(WPAT_NumberLevel, 0);
          wpRichText1.ASet(WPAT_IndentFirst, 0);
          wpRichText1.ASet(WPAT_IndentLeft, 0);
          wpRichText1.InputString(#13); //for some reason still processing the back space
        end
      else
        if (wprichtext1.Textcursor.active_posinpar=0) and (wpRichText1.currAttr.IndentLeft>0) then
          begin
            key:=0;
            wpRichText1.currAttr.decIndent;
            wpRichText1.InputString(#13); ////for some reason still processing the back space
          end;
    end;

The first section of the code only works if a top level number/bullet. Not sure how to get it to decrease the indent by 1. Any pointers please?

#1 ♥ 0
4.1k Views 2 users read 1 min
support

There is also a DecOutlineLevel.

WPTools uses already a handling for backspace and resets paragraph properties. Other behaviou may be included in a future version of wpools.

#2 ♥ 0
This category is archived. No new posts are possible.