Solved

GPF while assigning a TImage - why?

Posted on 1998-10-03
6
148 Views
Last Modified: 2010-04-06
I have a record in my ap which contains a TImage:

Pix = record
  P: TImage;
  Left,Top: Integer;
end;

var fp: File of Pix;
    CurrentPic: Pix;

I want to store a series of pictures on disk.  The following line causes a GPF:

CurrentPic.Picture := Image1.Picture;  

What am I doing wrong.  I am using D1 and WFW 3.11
0
Comment
Question by:jdthedj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1341576
Hi jdthedj,

have you created memmory for CurrentPic?
like :

PPix = ^TPix;
TPix = record
  P: TImage;
  Left,Top: Integer;
end;

var fp: File of TPix;
    CurrentPic: PPix;

begin
New(CurrentPic);
CurrentPic.Picture.Assign(Image1);
{OR? CurrentPic^.Picture := Image1.Picture;   }

.

end;

{don't forget to free them when finished!}

Zif.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341577
You need to use

CurrentPic.P := Image1.Picture;

Vik
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341578
Pix is a record not an image that's why you need to use it's property P as I showed you above which is the image,,,,,

Actually this is the one that you need ,,,,,

CurrentPic.P.Picture := Image1.Picture;

//Vik
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:jdthedj
ID: 1341579
Hi Viktornet - thanks for replying

Hello ZifNab - thanks for the answer.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341580
There is actually an easier way that i haven't tested but is 100% easier....

CurrentPic.P.Assign(Image1.Picture);

:->
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1341581
No prob. :-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question