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
 Issue with latest 4.0.1 version
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

swierzbicki

France
5 Posts

Posted - Mar 06 2012 :  05:10:38  Show Profile  Reply
Hello,

I'm getting errors since updating to the latest 4.0.1 version.
Method CheckSelectedImageIsVisible is throwing an exception :
"Control '' has no parent windows".

I'm basically creating ImageEnMView instance at runtime (I'm adding TIFF picture at the end of an FastReport report) :

ImageEnMView := TImageEnMView.create(Nil);
      DocumentStream := TMemoryStream.create();
      Try
        ImageEnMView.Clear;

        (QrDocuments.Fieldbyname('Documents') as TBlobField).SaveToStream(DocumentStream);
        DocumentStream.Position := 0; // <<<< ADDED THIS

        ImageEnMView.MIO.LoadFromStreamTIFF(DocumentStream);
        ImageEnMView.MIO.Update;
        If not(QrDocuments.Fieldbyname('Documents').IsNull) Then
          For i := 0 To ImageEnMView.ImageCount - 1 Do
          Begin
            ImageEnMView.SelectedImage := i;
            Page := TfrxReportPage.create(frxReport);
            Page.CreateUniqueName;

            If ImageEnMView.Bitmap.Width > ImageEnMView.Bitmap.Height Then
              Page.Orientation := poLandscape
            Else
              Page.Orientation := poPortrait;
            Page.LeftMargin := 0;
            Page.RightMargin := 0;
            Page.TopMargin := 0;
            Page.BottomMargin := 0;
            Image := TfrxPictureview.create(Page);
            Image.CreateUniqueName;
            Image.Align := baclient;
            Image.Picture.Assign(ImageEnMView.Bitmap);
          End;
      Finally
        DocumentStream.Free;
        ImageEnMView.Free;
      End;


To solve this issue I have modified the method

quote:
procedure TImageEnMView.CheckSelectedImageIsVisible;
// NPC: 23/11/11
var
info: PIEImageInfo;
iViewX, iViewY : integer;
begin
if (fSelectedItem >= 0) and (fMultiSelecting = False) then
begin
iViewX := fViewX;
iViewY := fViewY;
info := PIEImageInfo(fImageInfo[fSelectedItem]);

if info^.X < iViewX then
iViewX := info^.X
else if (Parent <> nil) then
if info^.X + fThumbWidth > iViewX + ClientWidth then
iViewX := info^.X - ClientWidth + fThumbWidth;

if info^.Y < iViewY then
iViewY := info^.Y
else if (Parent <> nil) then

if info^.Y + fThumbHeight > iViewY + ClientHeight then
iViewY := info^.Y - ClientHeight + fThumbHeight;

SetViewXY(iViewX, iViewY);
end;
end;


fab

1310 Posts

Posted - Mar 06 2012 :  07:31:31  Show Profile  Reply
Hello,
thank you. You fix is Ok.
In the next minor release it will be:

procedure TImageEnMView.CheckSelectedImageIsVisible;
// NPC: 23/11/11
var
  info: PIEImageInfo;
  iViewX, iViewY : integer;
begin
  if assigned(Parent) and (fSelectedItem >= 0) and (fMultiSelecting = False) then
  begin
    iViewX := fViewX;
    iViewY := fViewY;
    info := PIEImageInfo(fImageInfo[fSelectedItem]);

    if info^.X < iViewX then
      iViewX := info^.X
    else if info^.X + fThumbWidth > iViewX + ClientWidth then
      iViewX := info^.X - ClientWidth + fThumbWidth;

    if info^.Y < iViewY then
      iViewY := info^.Y
    else if info^.Y + fThumbHeight > iViewY + ClientHeight then
      iViewY := info^.Y - ClientHeight + fThumbHeight;

    SetViewXY(iViewX, iViewY);
  end;
end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: