Space line example
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Space line example
Hello
I am really lost how to work with TCustomRVParaInfo.
I need to use double line space and could you give me an exemple how to do it and working with TCustomRVParaInfo?
Thanks
I am really lost how to work with TCustomRVParaInfo.
I need to use double line space and could you give me an exemple how to do it and working with TCustomRVParaInfo?
Thanks
-
- Site Admin
- Posts: 17572
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Site Admin
- Posts: 17572
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
First, consider using RichViewActions. In this case, you do not need to write any code: just create a button and assign rvActionLineSpacing200 to its Action property, and it works!
If you do not want using RichViewActions, you need to process OnParaStyleConversion event to apply commands to paragraphs.
You can use this demo as a sample:
http://www.trichview.com/forums/viewtopic.php?t=2074
How to add commands for the double and the single line spacings:
1) add new constants having unique values among other PARA_* constants:
2) add buttons btnLineSpacingDouble, btnLineSpacingSingle (this demo uses TSpeedButtons). Assign their properties: GroupIndex 5 (it's a coincidence that it equals to the constant above; just choose any value that does not equal to GroupIndex of other buttons), AllowAllUp = True
3) In OnClick of btnLineSpacingDouble:
In OnClick of btnLineSpacingSingle
4) Add in TForm1.rveParaStyleConversion, above the line "// add your code here....":
5) Change TForm1.rveCurParaStyleChanged:
If you do not want using RichViewActions, you need to process OnParaStyleConversion event to apply commands to paragraphs.
You can use this demo as a sample:
http://www.trichview.com/forums/viewtopic.php?t=2074
How to add commands for the double and the single line spacings:
1) add new constants having unique values among other PARA_* constants:
Code: Select all
PARA_LINESPACING_DOUBLE = 5;
PARA_LINESPACING_SINGLE = 6;
3) In OnClick of btnLineSpacingDouble:
Code: Select all
ApplyParaStyleConversion(PARA_LINESPACING_DOUBLE)
Code: Select all
ApplyParaStyleConversion(PARA_LINESPACING_SINGLE)
Code: Select all
PARA_LINESPACING_DOUBLE:
begin
ParaInfo.LineSpacing := 200;
ParaInfo.LineSpacingType = rvlsPercent
end;
PARA_LINESPACING_SINGLE:
begin
ParaInfo.LineSpacing := 100;
ParaInfo.LineSpacingType = rvlsPercent
end;
Code: Select all
var pi: TParaInfo;
begin
pi := rvs.ParaStyles[dbrve.CurParaStyleNo];
SetAlignmentToUI(pi.Alignment);
btnLineSpacingDouble.Down := (pi.LineSpacing=200) and (pi.LineSpacingType=rvlsPercent);
btnLineSpacingSingle.Down := (pi.LineSpacing=100) and (pi.LineSpacingType=rvlsPercent);
end;
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Hi Sergey
Thanks for your help once again. This project that I am doing I can't use action.
I was able to use double line space in my code, but I am having a problem.
When I change the space line of my text, the change is not record with my text in the table, and when I open the text once again, it didn't come the way that I have formated, with double line space.
I made a small program with access database, I'd like you to show it and tell me what I am doing wrong.
Another thing, you can see that I have two text in my table, the beatle and the calf. Each one I have a different margins. I'd like you to show me how to make the rulers obay the formatted margins.
This will solve my problem
thanks
Please, get my code from here
http://www.infosoftlanguages.com/arquivos/editorg.zip
Thanks for your help once again. This project that I am doing I can't use action.
I was able to use double line space in my code, but I am having a problem.
When I change the space line of my text, the change is not record with my text in the table, and when I open the text once again, it didn't come the way that I have formated, with double line space.
I made a small program with access database, I'd like you to show it and tell me what I am doing wrong.
Another thing, you can see that I have two text in my table, the beatle and the calf. Each one I have a different margins. I'd like you to show me how to make the rulers obay the formatted margins.
This will solve my problem
thanks
Please, get my code from here
http://www.infosoftlanguages.com/arquivos/editorg.zip
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Sergey, just one thing:
Why do I need to use OnParaStyleConversion if this way works fine too?
Take a look at this code:
const
PARA_LINESPACING_DOUBLE = 5;
PARA_LINESPACING_SINGLE = 6;
procedure TForm1.FormCreate(Sender: TObject);
begin
Qdocs.Open;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
RVStyle1.ParaStyles.Items[0].LineSpacing := 150;
RVStyle1.ParaStyles.Items[0].LineSpacingType := rvlsPercent;
DBSRichViewEdit1.RichViewEdit.Format;
DBSRichViewEdit1.RichViewEdit.ApplyParaStyleConversion(PARA_LINESPACING_DOUBLE);
DBSRichViewEdit1.RichViewEdit.DataSource.DataSet.Post;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
RVStyle1.ParaStyles.Items[0].LineSpacing := 100;
RVStyle1.ParaStyles.Items[0].LineSpacingType := rvlsPercent;
DBSRichViewEdit1.RichViewEdit.Format;
DBSRichViewEdit1.RichViewEdit.ApplyParaStyleConversion(PARA_LINESPACING_SINGLE);
DBSRichViewEdit1.RichViewEdit.DataSource.DataSet.Post;
end;
Why do I need to use OnParaStyleConversion if this way works fine too?
Take a look at this code:
const
PARA_LINESPACING_DOUBLE = 5;
PARA_LINESPACING_SINGLE = 6;
procedure TForm1.FormCreate(Sender: TObject);
begin
Qdocs.Open;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
RVStyle1.ParaStyles.Items[0].LineSpacing := 150;
RVStyle1.ParaStyles.Items[0].LineSpacingType := rvlsPercent;
DBSRichViewEdit1.RichViewEdit.Format;
DBSRichViewEdit1.RichViewEdit.ApplyParaStyleConversion(PARA_LINESPACING_DOUBLE);
DBSRichViewEdit1.RichViewEdit.DataSource.DataSet.Post;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
RVStyle1.ParaStyles.Items[0].LineSpacing := 100;
RVStyle1.ParaStyles.Items[0].LineSpacingType := rvlsPercent;
DBSRichViewEdit1.RichViewEdit.Format;
DBSRichViewEdit1.RichViewEdit.ApplyParaStyleConversion(PARA_LINESPACING_SINGLE);
DBSRichViewEdit1.RichViewEdit.DataSource.DataSet.Post;
end;
-
- Site Admin
- Posts: 17572
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17572
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm