Solved

GPF while assigning a TImage - why?

Posted on 1998-10-03
6
144 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now