Solved

Pointers, what do I do wrong here?

Posted on 2008-10-21
3
172 Views
Last Modified: 2010-04-05
var LPRGBTripleArray : ^TRGBTripleArray;
    LBitmapScanned : array[0..125] of ^TRGBTripleArray;
   
    i : Integer;
begin
  for i := 0 to 125 do
  begin
    LBitmapScanned[i] := MyBitmap.ScanLine[i];    
 
  end;
 
  LPRGBTripleArray := LBitmapScanned[0]; //compiler says that the type is different here, but it is ^TRGBTripleArray in both cases...
 
end;  

Thank you

panJames
 
0
Comment
Question by:panJames
[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
  • 2
3 Comments
 
LVL 6

Expert Comment

by:ChristianWimmer
ID: 22768784
Define a new type called PRGBTripleArray and use it instead.
type
  PRGBTripleArray = ^TRGBTripleArray;
 
var LPRGBTripleArray : PRGBTripleArray;
    LBitmapScanned : array[0..125] of PRGBTripleArray;

Open in new window

0
 

Author Comment

by:panJames
ID: 22774357
It compiles fine now, thank you.

But what was wrong with my approach?

panJames
0
 
LVL 6

Accepted Solution

by:
ChristianWimmer earned 500 total points
ID: 22775147
You define an anonymous type (^TRGBTripleArray) for every variable declaration. Although the data structure is the same, Delphi does not consider them to be the same. They are declared twice and thus are different types. If you create a new type and let the variables use them instead, the assignment is no more a problem.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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