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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageENMView.Checkboxes and PrintPreviewParams.PrintSelected
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Fábio Nascimento

Brazil
77 Posts

Posted - Sep 18 2025 :  10:30:54  Show Profile  Reply
Hi

Does ImageENMView.Checkboxes and PrintPreviewParams.PrintSelected work together?

I'm using ImageENMView to show a Multipage Tiff file and I'd like the user to be able to select the pages to print using the checkboxes.

But when I code:

imgThumbs.MIO.PrintPreviewParams.PrintSelected := True;
  imgThumbs.MIO.DoPrintPreviewDialog('Imprimir', True, 'Visualizar Impressão', False);


I prints all the pages regardless it's checked (which I tought means selected).

In my old system, I had to use a listbox with the page numbers, create a new PrintImageENMView, loop through the pages checkboxes and code PrintImageENMView.SetIEBitmapEx(iIndex, iIEBitmap); in order to print only the selected pages in the listbox.

I think theres a better way to achieve that?

What am I missing?

Thanks!

xequte

39146 Posts

Posted - Sep 18 2025 :  11:08:57  Show Profile  Reply
Hi

PrintSelected only makes the printing selection combobox default to "Print Selected".

Calling imgThumbs.MIO.DoPrintPreviewDialog() will carry the selection over from imgThumbs, but only the regular selection, not checkboxes. So you should convert your checkbox selection to a normal selection prior to calling DoPrintPreviewDialog().

Please see the example at:

http://www.imageen.com/help/TImageEnMView.Checked.html

I'll look at making it handle checkbox selection automatically in the next update.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Fábio Nascimento

Brazil
77 Posts

Posted - Sep 18 2025 :  13:41:59  Show Profile  Reply
Ah ok cool xequte.

I wrote a helper for that:

procedure TImageEnMViewHelper.PrintCheckedImages;
var
  I: Integer;
  LWasMultiSelect: Boolean;
begin

  LWasMultiSelect := Self.EnableMultiSelect;
  LockUpdate;

  try
    EnableMultiSelect := True;
    Deselect;
    BeginSelectImages(True);

    for I := 0 to ImageCount - 1 do
      if Checked[I] then
        SelectedImage := I;

    EndSelectImages;

    if CheckedCount > 0 then
      MIO.PrintPreviewParams.PrintSelected := True;

    MIO.DoPrintPreviewDialog('Imprimir', True, 'Visualizar Impressão', False);

  finally
    EnableMultiSelect := LWasMultiSelect;
    UnlockUpdate;
  end;

end;


But this way even though it carries on the checked pages as selection, it shows all the pages..

I'd like to add an option to show only the checked images on the PrintPreviewDialog instead, is that possible?

Thanks

Fábio
Go to Top of Page

Fábio Nascimento

Brazil
77 Posts

Posted - Sep 18 2025 :  14:16:31  Show Profile  Reply
I tried using Filter but it seens that DoPrintPreviewDialog does not care about that and shows all pages regardless.
Go to Top of Page

Fábio Nascimento

Brazil
77 Posts

Posted - Sep 18 2025 :  17:52:04  Show Profile  Reply
I did it now the same way that I did in 2016:

procedure TImageEnMViewHelper.PrintAllOrCheckedPages;
var
  TempView: TImageEnMView;
  I, PaginaAtual: Integer;
  ieBmp: TIEBitmap;
begin

  if Self.ImageCount = 0 then begin
    ShowAlerta('Nenhuma imagem sendo exibida para ser impressa!');
    Exit;
  end;

  if Self.CheckedCount = 0 then
    Self.MIO.DoPrintPreviewDialog('Imprimir', True, 'Visualizar Impressão', False)
  else begin

    PaginaAtual := Self.SelectedImage;
    ieBmp := TIEBitmap.Create;
    TempView := TImageEnMView.Create(nil);
    TempView.MIO.PrintPreviewParams.DlgMaximized := True;
    TempView.MIO.PrintPreviewParams.MarginTop := 0;
    TempView.MIO.PrintPreviewParams.MarginLeft := 0;
    TempView.MIO.PrintPreviewParams.MarginRight := 0;
    TempView.MIO.PrintPreviewParams.MarginBottom := 0;
    TempView.AnnotationsVisible := True;

    Self.LockUpdate;

    try

      for I := 0 to Self.ImageCount - 1 do begin

        Self.SelectedImage := I;

        if Self.Checked[i] then begin
          ieBmp.AssignImage(Self.IEBitmap);
          TempView.InsertImage(TempView.ImageCount,ieBmp);
        end;

      end;

      TempView.SelectedImage := 0;
      TempView.MIO.DoPrintPreviewDialog('Imprimir', True, 'Visualizar Impressão', False);

    finally
      ieBmp.Free;
      TempView.Free;
      Self.SelectedImage := PaginaAtual;
      Self.UnlockUpdate;
    end;

  end;

end;


When you can, please let me know if there's a better way to do that!

Also, I'll work mainly with the checkbox for selection, so DeleteSelectedImages will not work too, I'll have to create a helper SelectCheckedPages I guess, would be nice to have a way to use the checks or the selection itself.

Thanks!

Go to Top of Page

xequte

39146 Posts

Posted - Sep 19 2025 :  01:52:27  Show Profile  Reply
Hi

Yes, that looks the best way to show only checked images.

Perhaps there should be some way to make checkboxes function like regular selections. I'll look into that.

Also, maybe filtering (e.g. by checked status) should be possible to only show the checked images (and be applied in the print dialog). I'll look into that too.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Fábio Nascimento

Brazil
77 Posts

Posted - Sep 19 2025 :  06:45:56  Show Profile  Reply
Hi xequte, thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: