Bullets and numbering

General TRichView support forum. Please post your questions here
Post Reply
oz8hp
Posts: 3
Joined: Fri Apr 17, 2015 7:38 am

Bullets and numbering

Post by oz8hp »

I have been testing this component for a couple of days now and it looks like I need to buy it.
But I first need to figure out how to make bullets and numbering work on the DB version of the editor.
I have found a sample on this forum that has bullets and numbering, but when I copy the code to a DB version it stops working.

What might I be doing wrong?
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

When the database is changed in an editing state, the content of DB-controls, including TDBRichViewEdit, may be reloaded.

In TRichView demos, the code for adding bullets is:

Code: Select all

RichViewEdit1.ApplyListStyle(CreateBullets,0,0,False,False);
where CreateBullets may add a new item in RichViewEdit1.Style.ListStyles.
ApplyListStyle, before making the actual work, turns the database in an editing mode. So
1) bullets are added in RVStyle
2) database is switched to an editing state
3) the content of RichViewEdit (and the linked RVStyle) is reloaded, and the changes made on the step 1 are lost
4) the editor tries to apply non-existing bullets.

The solution: switching to an editing state before the whole operation. You can do in using CanChange:

Code: Select all

if DBRichViewEdit1.CanChange then
  DBRichViewEdit1.ApplyListStyle(CreateBullets,0,0,False,False);
oz8hp
Posts: 3
Joined: Fri Apr 17, 2015 7:38 am

Post by oz8hp »

I have made the button click like this now. But I still don't get any bullets.
The CreateBullets, CreateNumbering, GetListNo and CaretMove are copied from the demo in http://www.trichview.com/forums/viewtop ... +numbering

Code: Select all

procedure TfrmMdEditor.btnBulletsClick(Sender: TObject);
begin
  if RichViewEdit.CanChange then
    begin
      if btnBullets.Down then
        RichViewEdit.RemoveLists(False)
      else
        RichViewEdit.ApplyListStyle(CreateBullets, 0, 0, False, False);
    end;
end;
Sergey Tkachenko wrote:When the database is changed in an editing state, the content of DB-controls, including TDBRichViewEdit, may be reloaded.

In TRichView demos, the code for adding bullets is:

Code: Select all

RichViewEdit1.ApplyListStyle(CreateBullets,0,0,False,False);
where CreateBullets may add a new item in RichViewEdit1.Style.ListStyles.
ApplyListStyle, before making the actual work, turns the database in an editing mode. So
1) bullets are added in RVStyle
2) database is switched to an editing state
3) the content of RichViewEdit (and the linked RVStyle) is reloaded, and the changes made on the step 1 are lost
4) the editor tries to apply non-existing bullets.

The solution: switching to an editing state before the whole operation. You can do in using CanChange:

Code: Select all

if DBRichViewEdit1.CanChange then
  DBRichViewEdit1.ApplyListStyle(CreateBullets,0,0,False,False);
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Can you send me a simple example to richviewgmailcom?
oz8hp
Posts: 3
Joined: Fri Apr 17, 2015 7:38 am

Post by oz8hp »

That will take some work because I am using UniDAC as DB connection and some of my own utilities as well.
But I will give it a go and see if I can do it.

- is there a time limit and the trialversion I have installed? (if so I need to hurry up :) )
Sergey Tkachenko wrote:Can you send me a simple example to richviewgmailcom?
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, there are no time limits in our trials.
Post Reply