Page 1 of 1
Why does srvActionPageSetup1 only open in pixel values?
Posted: Sun Mar 18, 2012 9:15 pm
by alexandreq
Hi,
Sergey, I have my both ruller (vertical and horizontal) settled in cm (ruCentimeters), my unitdisplay and unitprograms are both in ruCentimeters too.
When I run the srvActionPageSetup1.Execute, the configuration comes in pixel and not centimeters, why? Something that I missed?
thanks
Posted: Mon Mar 19, 2012 12:09 pm
by Sergey Tkachenko
These values are displayed in RVAControlPanel.UnitsDisplay.
Look at the ActionTest demo.
Initial settings:
Code: Select all
RVA_ConvertToTwips(srvActionsResource);
RVAControlPanel1.UnitsProgram := rvstuTwips;
SRichViewEdit1.ConvertToTwips;
cmbUnits.ItemIndex := ord(SRichViewEdit1.UnitsProgram);
RVAControlPanel1.UnitsDisplay := SRichViewEdit1.UnitsProgram;
First, this code converts internal measurement in RichViewActions from pixels to twips, to provide more precise measurement.
Next, the same is done for SRichViewEdit1.
Next, RVAControlPanel1.UnitsDisplay are changed according to SRichViewEdit1.UnitsProgram (actually, SRichViewEdit1.UnitsProgram do not matter, they are used internally and can be different from RVAControlPanel1.UnitsDisplay; but RVAControlPanel1.UnitsDisplay are important because they are used in all dialogs).
In this demo, the both ruler's UnitsDisplay are initially the same as SRichViewEdit1.UnitsProgram, so they are not assigned here.
---
Units of measurement are changed in the combobox:
Code: Select all
procedure TForm3.cmbUnitsClick(Sender: TObject);
var i: Integer;
begin
for i := 0 to High(Editors) do
Editors[i].UnitsProgram := TRVUnits(cmbUnits.ItemIndex);
RVAControlPanel1.UnitsDisplay := TRVUnits(cmbUnits.ItemIndex);
SclRVRuler1.UnitsDisplay := TRulerUnits(cmbUnits.ItemIndex);
SclRVRuler2.UnitsDisplay := TRulerUnits(cmbUnits.ItemIndex);
end;
Posted: Tue Mar 20, 2012 12:38 am
by alexandreq
Sergey,
Doesn't this function RVA_ConvertToTwips(MyForm) accept forms, only datamodule?
I have an ActionList1 in my main form and when I passed it, I have an erro.
Posted: Tue Mar 20, 2012 9:54 am
by Sergey Tkachenko
RVA_ConvertToTwips can be used for a form or for a datamodule.
Posted: Wed Mar 21, 2012 1:47 am
by alexandreq
Sergey,
My form has 3 DBSRIchViewEdits, should I procedure with all editores with the same code?
Posted: Wed Mar 21, 2012 4:53 pm
by Sergey Tkachenko
Only the part of code related to TSRichViewEdit.
Initial settings:
- make sure that all SRichViewEdits have the same value of UnitsProgram (not necessary, actually, but for any case)
- ConvertToTwips must be called for all editor.
When switching units
- change UnitsProgram for all SRichViewEdits (not necessary, actually, but for any case)