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
Why does srvActionPageSetup1 only open in pixel values?
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
These values are displayed in RVAControlPanel.UnitsDisplay.
Look at the ActionTest demo.
Initial settings:
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:
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;
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;
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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)
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)