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
 DoPrintPreviewDialog
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

naser123

Iran
5 Posts

Posted - Apr 05 2015 :  08:19:41  Show Profile  Reply
When I change the print setup Orientation, system take an error:
list index out of bounds(10) that 10 is count of image into the imaeenmview component.

xequte

38944 Posts

Posted - Apr 05 2015 :  10:21:22  Show Profile  Reply
Hi

What version of ImageEn are you using?


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

naser123

Iran
5 Posts

Posted - Apr 06 2015 :  01:47:10  Show Profile  Reply
4.1.4
Go to Top of Page

xequte

38944 Posts

Posted - Apr 06 2015 :  03:08:27  Show Profile  Reply
Hi

I think it is an issue in the version you are using. Email us to see what newer versions you are entitled to, or extend your registration at:

http://www.imageen.com/order/

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

madas

Germany
21 Posts

Posted - Mar 21 2016 :  09:46:53  Show Profile  Reply
I am getting the same error when using DoPrintPreviewDialog on a TImageEnMIO with a multi-page tiff loaded. The error occurs after clicking Ok or Cancel in the printer setup dialog.

Version used 6.2.0.0
Go to Top of Page

xequte

38944 Posts

Posted - Mar 21 2016 :  14:04:21  Show Profile  Reply
Hi

Can you reproduce it in any of our demos? (perhaps by adding a little code)

If so, please advise the steps to reproduce it.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

madas

Germany
21 Posts

Posted - Mar 22 2016 :  01:09:04  Show Profile  Reply
I will have a look within one of the demos.

regards.

madas
Go to Top of Page

madas

Germany
21 Posts

Posted - Mar 22 2016 :  02:05:17  Show Profile  Reply
Good morning. I have found the code which is causing the problem. For a MIO DoPrintPreviewDialog is calling a form of class "TfiePrnForm3". This form has a FormActivate event handler which is loading the pics of the org. MIO (srcview) into a temp MIO (ImageEnMView1). After confirming the exception dialog the image count of the MIO on the left side of the "TfiePrnForm3"-dialog was increased by one. So the MIO must have refilled by the FormActivate event. So simply fix for me was by clearing the temp MIO. Don't know if it is the correct fix.


procedure TfiePrnForm3.FormActivate(Sender: TObject);
var
  i, idx: integer;
begin
  Screen.Cursor := crHourglass;
  try
    Application.ProcessMessages; // first draws all controls (to avoid "Swiss Cheese")
    ImageEnMView1.Clear; //fix add by myself
    ImageEnMView1.LockUpdate;
    fActivating := true;

    if IEGlobalSettings().UseButtonGlyphsInDialogs = False then
    begin
      btnPrint.Glyph := nil;
      btnSetup.Glyph := nil;
      btnCancel.Glyph := nil;
      cmbPosition.Style := csDropDownList;
    end;
    fOriginalDlgWidth  := ClientWidth;
    fOriginalDlgHeight := ClientHeight;
    LoadParameters;
    ImageEnMView1.FillThumbnail := false;  
    ImageEnMView1.SetModernStyling;   
    ImageEnMView1.SideGap := 6;
    ImageEnMView1.Background := clBtnFace;
    ImageEnMView1.GradientEndColor := clGray;
    ImageEnMView1.ThumbnailDisplayFilter := rfLanczos3;
    ImageEnMView1.ThumbnailsBorderColor := clSilver;
    
    // load ImageEnMView1
    srcview := mio.AttachedMView as TImageEnMView;

    for i := 0 to srcview.ImageCount - 1 do
    begin
      idx := ImageEnMView1.AppendImage;
      ImageEnMView1.SetIEBitmapEx(idx, srcview.GetTIEBitmap(i));
      srcview.ReleaseBitmap(idx, false); // list index error is thrown here

      if srcview.ImageTopText[i] <> '' then
        ImageEnMView1.ImageTopText[idx] := srcview.ImageTopText[i]
      else
      if srcview.ImageBottomText[i] <> '' then
        ImageEnMView1.ImageTopText[idx] := srcview.ImageBottomText[i]
      else
      ImageEnMView1.ImageTopText[idx] := 'Image ' + IntToStr(i + 1);
      if PrintAnnotations then
        ImageEnMView1.MIO.Params[idx].Assign( srcview.MIO.Params[i] );
    end;
    ImageEnMView1.SelectedImage := 0;

    // Get our selection from the source
    if srcview.MultiSelectedImagesCount > 0 then
      ImageEnMView1.CopySelection(srcview);

    cmbPrintSelector.ItemIndex := 0;

    fActivating := false;
    ImageSelect;        
    SetLanguage_units;
  finally
    ImageEnMView1.UnlockUpdate;
    Screen.Cursor := crDefault;
  end;
end;


greetings.

madas
Go to Top of Page

madas

Germany
21 Posts

Posted - Mar 22 2016 :  02:07:37  Show Profile  Reply
and btw.: then using the procedure ShowWindowsPrintWizard(ImageEnMView: TImageEnMView; bAllImages: Boolean); overload; of the iexWindowsFunctions the image count is twice as high as expected too. :(
Go to Top of Page

xequte

38944 Posts

Posted - Mar 22 2016 :  17:43:22  Show Profile  Reply
Hi

I'm afraid i cannot reproduce this in v6.2.2. Also, the code looks like to be correct. Clear should have no effect in FormActivate because the ImageEnMView should already be empty (form has just been created).

Can you please test in 6.2.2, and if you can still reproduce give me the exact steps to take.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

madas

Germany
21 Posts

Posted - Mar 23 2016 :  05:01:27  Show Profile  Reply
Hi Nigel,

just after the form "TfiePrnForm3" is created all is fine. The count of thumbs in the left pane MIO is exactly the same as of the MIO from which the method "DoPrintPreviewDialog" was called. And the FormActivate was called once. But if you click on the "printer setup" button within the preview form and coming back from the setup dialog the preview form becomes active again and so the FormActivate event is fired again and the event handler is trying to add the pics of the original MIO to the temp MIO for the second time. :( So ReleaseBitmap is called with a wrong index.

But i will have a look at the 6.2.2 release.

greetings.

madas
Go to Top of Page

madas

Germany
21 Posts

Posted - Mar 23 2016 :  05:42:44  Show Profile  Reply
Have tried it with the 6.2.2 version. Problem still exists within my application. But now the funny part. If i create a new project with only one TImageEnMView attached to the form and doing the same as in the other project then i don't get this error. Here the FormActivate event isn't fired again after coming back from the printer setup dialog. :( Strange.
Go to Top of Page

xequte

38944 Posts

Posted - Mar 28 2016 :  17:39:54  Show Profile  Reply
Thanks, I'll add some code to prevent double calls to FormActivate (which unfortunately are inherently risky, and only exist for historical reasons).


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: