ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Print dialog settings reset button

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
spurgeon Posted - Feb 10 2022 : 16:01:07
I'd like to save and load print settings (https://www.imageen.com/help/index.php?topic=TIOPrintPreviewParams.LoadFromFile), but I also want the user to be able to reset the dialog to defaults.

Is it possible to add a Reset button on the print dialog(s) to restore the defaults in an upcoming release?

Here's an example of what I'm thinking:

5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 15 2022 : 03:57:01
Yes, it will.

Nigel
Xequte Software
www.imageen.com
spurgeon Posted - Feb 14 2022 : 14:55:01
Thanks, much appreciated. Will fPrintPreviewParams.Reset(); be available in the next official 10.x release as well?
xequte Posted - Feb 11 2022 : 22:19:24
Hi

You can email me for an update, which supports fPrintPreviewParams.Reset();

Nigel
Xequte Software
www.imageen.com
spurgeon Posted - Feb 11 2022 : 15:40:20
Thanks for the docs reference. I added this code below, which seems to work if any others are interested:


procedure TMyForm.Print(printSettingsFilePath: WideString);
begin
  if ImageEnVect1.IO.Params.ImageCount > 1 then begin
    if FileExists( printSettingsFilePath ) then begin
      ImageEnMView1.MIO.PrintPreviewParams.LoadFromFile(printSettingsFilePath);
    end;
    ImageEnMView1.MIO.DoPrintPreviewDialog;
    ImageEnMView1.MIO.PrintPreviewParams.SaveToFile(printSettingsFilePath);
  end else begin
    if FileExists( printSettingsFilePath ) then begin
      ImageEnVect1.IO.PrintPreviewParams.LoadFromFile(printSettingsFilePath);
    end;
    ImageEnVect1.IO.DoPrintPreviewDialog(iedtDialog);
    ImageEnVect1.IO.PrintPreviewParams.SaveToFile(printSettingsFilePath);
  end;
end;
procedure TMyForm.ImageEnVect1ShowDialog(Sender: TObject;
  DlgType: TIEDlgType; Form: TForm);
begin
  if DlgType = iefPrintPreview then begin
    with TfiePrnForm2(Form) do
    begin
      // Create Reset button so users can reset the form values
      with TButton.Create( Form ) do
      begin
        Parent := Form;
        Left := btnSetup.Left + btnSetup.Width + {add same spacing as between OK and Cancel buttons} (btnCancel.Left - (btnOK.Left + btnOK.Width));
        Top := btnSetup.Top;
        Width := btnCancel.Width;
        Height := btnSetup.Height;
        Anchors := [akBottom, akLeft];
        Caption := iemsg(IEMSG_RESET); // Use ImageEn's localized string
        OnClick := PrintResetClicked;
      end;
    end;
  end else if DlgType = iefMultiPrintPreview then begin
    // TODO: Not sure where to put Reset button in layout yet
  end;
end;
procedure TMyForm.PrintResetClicked(Sender: TObject);
begin
  // Create a blank new version of TIOPrintPreviewParams with defaults
  FreeAndNil(TfiePrnForm2(TButton(Sender).Parent).fPrintPreviewParams); // free existing params so we can initialize new ones
  TfiePrnForm2(TButton(Sender).Parent).fPrintPreviewParams := TIOPrintPreviewParams.Create; // the Create constructor initializes defaults
  // Load the paramters into the print form
  TfiePrnForm2(TButton(Sender).Parent).LoadParameters;
  // Refresh the remaining items on the form -- TfiePrnForm2 (ieprnform2.pas) calls PrintPreview at the end of FormActivate to set the state of the window, so we repeat that here
  TfiePrnForm2(TButton(Sender).Parent).PrintPreview(nil);
end;
xequte Posted - Feb 10 2022 : 21:16:59
Hi

We'll consider that for a future update. You can add custom controls to dialogs using:

https://www.imageen.com/help/TIEView.OnShowDialog.html



Nigel
Xequte Software
www.imageen.com