Solved

GPF while assigning a TImage - why?

Posted on 1998-10-03
6
147 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 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 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