Page 1 of 1
ApplyListStyle
Posted: Fri Jun 22, 2007 5:03 pm
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?
Posted: Sun Jun 24, 2007 8:26 am
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)?
Posted: Tue Jun 26, 2007 8:04 pm
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.
Posted: Wed Jun 27, 2007 8:21 am
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.
Posted: Thu Aug 16, 2007 2:45 pm
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!
Posted: Fri Aug 17, 2007 11:07 am
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'.
Posted: Fri Aug 17, 2007 4:51 pm
by pdcuser
That did it. Thanks!