Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

GPF while assigning a TImage - why?

Posted on 1998-10-03
6
Medium Priority
?
154 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
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

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!

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

963 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