• my old way is not working in v5.

    This is the code I've been using to do the hanging indent in 4.22

    Code
    //on create formWPRichText1.Memo.FVersion2CompMode:=[wp2NoAutoIndentTabs];//to set the indent spot  WPRichText1.CurrAttr.IndentLeft := WPRichText1.GetXPositionTw;  WPRichText1.CurrAttr.IndentFirst := - WPRichText1.CurrAttr.IndentLeft ;//to reset the indent to normalprocedure TMainform.WPRichText1KeyPress(Sender: TObject; var Key: Char);begin  case Key of    #13 :  begin                 WPrichText1.InputString(#13);                 WPrichText1.CurrAttr.IndentLeft:=0;                 WPRichText1.CurrAttr.IndentFirst :=0;                 key:=#0;           end; //end #13  end;end;

    this generates an indent like this:

    Code
    normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text           hanging indent hanging indent hanging indent hanging indent            hanging indent hanging indent hanging indent hanging indent           hanging indent hanging indent hanging indent hanging indent normal text normal text normal text normal text normal text normal text normal text normal text


    but in v5 the global value wp2NoAutoIndentTabs doesn't work and I get this instead:

    Code
    normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text 
    
    
              hanging indent hanging indent hanging indent hanging indent  
         hanging indent hanging indent hanging indent hanging indent 
         hanging indent hanging indent hanging indent hanging indent 
    
    
    normal text normal text normal text normal text normal text normal text normal text normal text

    how can I get the previous behavior in v5?

    • Offizieller Beitrag

    Hi,

    In next release please check out the format option wpfHangingIndentWithTab.

    It allows format like

    Code
    text            hanging indent hanging indent
                     hanging indent hanging indent hanging indent hanging indent 
                     hanging indent hanging indent hanging indent hanging

    The indent to first tab will then also work - I think this is actually what you need. wp2NoAutoIndentTabs will not be used anymore, it also would have the contrary effect.

    Julian

  • another thing that works great with the old code is you can do something like this:

    [tab]1.[tab][set indent]more text

    and you will get this

    Code
    1.          more text more text more text more text more text                      more text more text more text more text more text                      more text more text more text more

    it will wrap at that point until you press enter. This is how WordPerfect does it's hanging indents.

    The code above works perfectly for what my users need, so I need to really work the same as the old way. It's pretty much like a number list, but I can use that because they'll often preformat the outline.

    like this

    Code
    1.     header1:  then type here
    
    
         2.     header2:  then type here

    so using automatic numbered lists is no good for this.

  • Almost there:

    1)Is there a way to set the indentleft without it auto tabbing ?

    When they set the indent now I do:
    WPRichText1.CurrAttr.IndentLeft := WPRichText1.GetXPositionTw;
    (before I was also doing this with it:
    WPRichText1.CurrAttr.IndentFirst := - WPRichText1.CurrAttr.IndentLeft ;
    but don't seem to need that anymore)

    before this would set the indent wherever the cursor happened to be. Now it inserts a 'tab' or somehow moves over to the right more when you set this.

    It's ok if there isn't, I just have to let them know. I'm just trying to keep as many things like before as I can.

    2) Indenting on same line as other text

    I can do this:

    Code
    normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text normal text           hanging indent hanging indent hanging indent hanging indent            hanging indent hanging indent hanging indent hanging indent           hanging indent hanging indent hanging indent hanging indent normal text normal text normal text normal text normal text normal text normal text normal text

    I can not do this:

    Code
    text           hanging indent hanging indent                hanging indent hanging indent                hanging indent hanging indent

    or this

    Code
    text           hanging indent hanging indent 
                            hanging indent hanging indent 
                            hanging indent hanging indent

    setting the indentleft moves the entire line over, this may be tied to the first question though.

    thanks for all your fast work and patience on this stuff.

    • Offizieller Beitrag

    I recieved the demo - I implemented the format option wpfDontTabToIndentFirst for you and sent you an update to the RTF-Engine.

    The only reason for it not to work without this option is that you want to use multiple tabs in the text before the indent, i.e [TAB]Text[TAB]aaaa bbb cccc which was not obvious to me.

    Just note that texts which are formatted using wpfDontTabToIndentFirst will look differently in Word.

  • I have tried this with the new version but it still auto tabs with that option turned on.

    I have wpfHangingIndentWithTab:=True
    and wpfDontTabToIndentFirst:=True


    This is what I use to set the indent. Is this incorrect?
    WPRichText1.CurrAttr.IndentLeft := WPRichText1.CPPosition;

    • Offizieller Beitrag

    Hi,

    >>This is what I use to set the indent. Is this incorrect?
    WPRichText1.CurrAttr.IndentLeft := WPRichText1.CPPosition;<<

    Yesm CPPosition is the position in count of characters form the beginning of the current text.

    You need GetXPositionTw

    I have now posted R7.5 and it includes 'Lines', better drag&drop and the automatic switching of the layout mode in WPMagaeHeaderFooter.

    Julian

  • did you just upload it now? I downloaded only less than an hour ago.

    I actually had it that way first, using
    WPRichText1.CurrAttr.IndentLeft := WPRichText1.GetXPositionTw;

    I get the same result.

    • Offizieller Beitrag

    Hi,

    you have the newest files then.

    I don't know how I can help you further. I tested the hanging indent stuff and it was working just fine. I also send an example and posted code.

    I guess you are fine if wpfDontTabToIndentFirst is true.

    wpfHangingIndentWithTab has the opposite meaning and should be off. This setting only changes the behaviour for lines which do have tabs, otherwise it is default. (compare to Word)

    Julian

  • Ok, I have only wpfDontTabToIndentFirst:=True

    and use only this to set the indent
    WPRichText1.CurrAttr.IndentLeft := WPRichText1.GetXPositionTw;

    It still pulls the whole line over, and tabs. It may be working how it's designed, but I need it to work like the example I sent or some other way to accomplish the same as this in 4.22.

    Code
    //on create form WPRichText1.Memo.FVersion2CompMode:=[wp2NoAutoIndentTabs]; //to set the indent spot   WPRichText1.CurrAttr.IndentLeft := WPRichText1.GetXPositionTw;   WPRichText1.CurrAttr.IndentFirst := - WPRichText1.CurrAttr.IndentLeft ; //to reset the indent to normal procedure TMainform.WPRichText1KeyPress(Sender: TObject; var Key: Char); begin   case Key of     #13 :  begin                  WPrichText1.InputString(#13);                  WPrichText1.CurrAttr.IndentLeft:=0;                  WPRichText1.CurrAttr.IndentFirst :=0;                  key:=#0;            end; //end #13   end; end;


    I have to reproduce this format
    [tab]1.[tab][set indent]more text

    Code
    1.          more text more text more text more text more text 
                          more text more text more text more text more text 
                          more text more text more text more


    I wouldn't be so worried about it if it wasn't very very important. I didn't want to do it in the first place but I have no choice. And if I can't do this I will have to stay with 4.22 because people will try to kill me probably if I have to take this out.

  • Bobby,

    Zitat

    And if I can't do this I will have to stay with 4.22 because people will try to kill me probably if I have to take this out.


    And I thought my users were a tough crowd... Woah...

    diamond

    • Offizieller Beitrag

    Hi Bobby,

    I tested it with this:

    ... it seems to do exactly what you need. But of course, the Header.DefaultTabstop must be set to something.

    Julian

  • AAAAAAAAAAAAAAAAARRRRGGGGGGGHHHHHHHHHHH!!!!!!!!!

    Finally, I found the problem!!!!

    Your code works. The problem is you were seeing something different than me. I will bet large amounts of money that you have AutoZoom off.

    If the AutoZoom property is set to wpAutoZoomOff or wpAutoZoomAdjustColumnCount it works just fine. Exactly as we have discussed.

    If the AutoZoom property is set to wpAutoZoomWidth or wpAutoZoomFullPage it does NOT work properly.

    I was using wpAutoZoomWidth which is why I was not seeing what you were. You can reproduce this behavior easily by setting AutoZoom to wpAutoZoomWidth or wpAutoZoomFullPage.

    I guess I will get to live a little longer . . . this time.