<< Click to Display Table of Contents >> Navigation: Programming > Printing and PDF Export > Label Priniting > Example Project > ReadProps and StoreProps |
ReadProps updates the visible controls
procedure TForm1.ReadProps;
begin
SheetWidth.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.SheetWidth , UseInch);
SheetHeight.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.SheetHeight , UseInch);
LabelWidth.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.LabelWidth , UseInch);
LabelHeight.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.LabelHeight , UseInch);
MargTop.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.Top , UseInch);
MargLeft.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.Left , UseInch);
MargRight.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.Right , UseInch);
MargBottom.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.Bottom , UseInch);
MargHorizontal.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.Horizontal , UseInch);
MargVertical.SetValueAsInchOrCM( WPRichText1.RTFData.LabelDef.Vertical , UseInch);
ColumnCount.Value := WPRichText1.RTFData.LabelDef.ColumnCount;
RowCount.Value := WPRichText1.RTFData.LabelDef.RowCount;
LabelName.Text := WPRichText1.RTFData.LabelDef.Name;
end;
StoreProps saves the definition to the correct item in a string list. "Name" is used to identify the item.
procedure TForm1.StoreProps;
var i : Integer;
begin
i := LabelName.Items.IndexOfName(WPRichText1.RTFData.LabelDef.Name);
if i>=0 then
LabelName.Items[i] := WPRichText1.RTFData.LabelDef.AsText
else
begin
i := LabelName.Items.Count;
LabelName.Items.Append(WPRichText1.RTFData.LabelDef.AsText);
end;
LabelName.ItemIndex := i;
end;