Page 1 of 1
Bullets and numbering
Posted: Sat Apr 18, 2015 7:39 am
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?
Posted: Sun Apr 19, 2015 8:25 am
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);
Posted: Mon Apr 20, 2015 2:20 pm
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);
Posted: Mon Apr 20, 2015 7:43 pm
by Sergey Tkachenko
Can you send me a simple example to richviewgmailcom?
Posted: Tue Apr 21, 2015 10:24 am
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?
Posted: Tue Apr 21, 2015 11:49 am
by Sergey Tkachenko
No, there are no time limits in our trials.