ApplyListStyle

General TRichView support forum. Please post your questions here
Post Reply
pdcuser
Posts: 17
Joined: Tue Jan 17, 2006 9:00 pm

ApplyListStyle

Post by pdcuser »

In my TRVStyle component, I have created a List Style. I have added three Levels to the List Style of type rvlstDecimal. The FormatString property is set to "%s." StartFrom is set to 1.

In my code I have:

Code: Select all

    FRichViewEdit.SelectAll;
    FRichViewEdit.ApplyListStyle(0,       // List Style
                                 1,       // Level
                                 7,       // Start From
                                 True,    // Use Start From
                                 False);  // Recursive
Although I have the AStartFrom parameter set to 7, it still starts from 1. How do I make it start from 7 without creating a new Level?
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

StartFrom and UseStartFrom are applied only to the first of the selected paragraphs. If they cannot be applied to the first paragraph, they are ignored. May be your document starts from table or break (horizontal line)?
pdcuser
Posts: 17
Joined: Tue Jan 17, 2006 9:00 pm

Post by pdcuser »

No, there is no table or break. I built a demo project from scratch to further investigate. As it turns out, the problem occurs when a level other than level 0 is selected. To replicate:

1. Build a new project in delphi
2. Add a TRichViewEdit and a TRVStyle. Link them together.
3. Create a new ListStyle. Give it three levels. Make them of type Decimal. Set the FormatString property to "%s."
4. Place a button on the form. In the OnClick event, enter the following code:

Code: Select all

  RichViewEdit1.SelectAll;
  RichViewEdit1.ApplyListStyle(1, 1, 2, True, False);
5. Run the project, type some text into the editor, and click the button. Although it should start with 2, it starts with 1. Now, try it using the 0 level by using the following code instead:

Code: Select all

  RichViewEdit1.SelectAll;
  RichViewEdit1.ApplyListStyle(1, 0, 2, True, False);
It works just fine in this scenario.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Are you sure that there are enough levels in Levels collection?
If yes, please create a simple project reproducing this bug and send it to me.
pdcuser
Posts: 17
Joined: Tue Jan 17, 2006 9:00 pm

Post by pdcuser »

I sent you the project awhile back. Were you able to receive it? If not, how do I send it to you? Thanks!
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Probably my answer was filtered out as a spam.
It was:
The problem is in incorrect FormatString.
'%s' always means the 0th level counter.
Level[1].FormatString must be '%1:s',
Level[2].FormatString must be '%2:s'.
pdcuser
Posts: 17
Joined: Tue Jan 17, 2006 9:00 pm

Post by pdcuser »

That did it. Thanks!
Post Reply