WPCubed Product Support

setting border by code?

7.4k Views 4 links 2 users read 3 min
support

That are page margins:

WPRichText1.Header.MarginLeft etc

#2 ♥ 0

Hi !

I use an enhanced labelprinting dialog. I´ve added the two rulers to the wprichtext.

In the Formactivate procedure I tried this:

procedure TLabelDruckenForm.FormActivate(Sender: TObject);
begin
  ColCountChange(nil);
  WPRichText1.Header.SetPageWH(
    WPSuperPrint1.Width,
    WPSuperPrint1.Height,
    0, 0, 0, 0);
  //WPRichText1.ReformatAll;
  WPRichText1.Header.LeftMargin  := 20;
  WPRichText1.Header.RightMargin := 20;
  WPRichText1.ReformatAll;
end;

But the result looks like this (new picture):
[](http://www.logview.info/frage.jpg)

Must I change some other values?

#3 ♥ 0
support

Thats basically the code I am using (You can pass the margis to SetPageWH instead of the zeros)

Did you set the WPRuler property in TWPRichText ?

Maybe SuperPrint does not use updated columns values, in this case Width will be wrong.

See the original code:

procedure TWPLabelForm.ColCountChange(Sender: TObject);
begin
  if FLocked then exit;
  WPSuperPrint1.PageWidth := PageWidth.Value;
  WPSuperPrint1.PageHeight := PageHeight.Value;

  WPSuperPrint1.Rows := RowCount.IntValue;
  WPSuperPrint1.Columns := ColCount.IntValue;
  WPSuperPrint1.MarginTop := TopMargin.Value;
  WPSuperPrint1.MarginLeft := LeftMargin.Value;
  WPSuperPrint1.MarginRight := RightMargin.Value;
  WPSuperPrint1.MarginBottom := BottomMargin.Value;
  WPSuperPrint1.InbetweenHorz := HorzMargin.Value;
  WPSuperPrint1.InbetweenVert := VertMargin.Value;

  WPSuperPrint1.LabelStartRow := StartRow.Value;
  WPSuperPrint1.LabelStartColumn := StartCol.Value;
  WPSuperPrint1.Copies := Copies.Value;

  WPRichText1.Header.SetPageWH(
    WPSuperPrint1.Width,
    WPSuperPrint1.Height,
    0, 0, 0, 0);
  WPRichText1.ReformatAll;
end;
#4 ♥ 0

Hi !

You can pass the margis to SetPageWH instead of the zeros

If set all 0 to 20. But the result is like this:
[](http://www.logview.info/frage.jpg)

Did you set the WPRuler property in TWPRichText ?

Of course.

Maybe SuperPrint does not use updated columns values, in this case Width will be wrong.

And what can I do in this case?

#5 ♥ 0
support

I don't know whats wrong, the label demo does it perfectly. Sometiong got broken during the reconstruction.

Juliuan

#6 ♥ 0

Hi Julian!

If I use your Labelprinting demo and this code:

procedure TWPLabelForm.ColCountChange(Sender: TObject);
begin
  if FLocked then exit;
  WPSuperPrint1.PageWidth := PageWidth.Value;
  WPSuperPrint1.PageHeight := PageHeight.Value;

  WPSuperPrint1.Rows := RowCount.IntValue;
  WPSuperPrint1.Columns := ColCount.IntValue;
  WPSuperPrint1.MarginTop := TopMargin.Value;
  WPSuperPrint1.MarginLeft := LeftMargin.Value;
  WPSuperPrint1.MarginRight := RightMargin.Value;
  WPSuperPrint1.MarginBottom := BottomMargin.Value;
  WPSuperPrint1.InbetweenHorz := HorzMargin.Value;
  WPSuperPrint1.InbetweenVert := VertMargin.Value;

  WPSuperPrint1.LabelStartRow := StartRow.Value;
  WPSuperPrint1.LabelStartColumn := StartCol.Value;
  WPSuperPrint1.Copies := Copies.Value;

  WPRichText1.Header.SetPageWH(
    WPSuperPrint1.Width,
    WPSuperPrint1.Height,
    100, 100, 100, 100);
  WPRichText1.ReformatAll;
end;

I got this result:
[](http://www.logview.info/frage.jpg)

So I don´t really works for me. No matter which label format is selected.

#7 ♥ 0
support

Maybe it is simply so that the editor does not have the focus

WPRichText1.SetFocusvalues(true)

#8 ♥ 0
This category is archived. No new posts are possible.