Why does srvActionPageSetup1 only open in pixel values?

General TRichView support forum. Please post your questions here
Post Reply
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Why does srvActionPageSetup1 only open in pixel values?

Post 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
Sergey Tkachenko
Site Admin
Posts: 17561
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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;
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17561
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

RVA_ConvertToTwips can be used for a form or for a datamodule.
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post by alexandreq »

Sergey,

My form has 3 DBSRIchViewEdits, should I procedure with all editores with the same code?
Sergey Tkachenko
Site Admin
Posts: 17561
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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)
Post Reply