Recent

Author Topic: Error: Incompatible types:got Pointer expected TOBject  (Read 8169 times)

davesimplewear

  • Sr. Member
  • ****
  • Posts: 319
    • Davids Freeware
Error: Incompatible types:got Pointer expected TOBject
« on: December 05, 2009, 12:18:26 am »
I get an error when trying to compile,  Error: Incompatible types: got "Pointer" expected "TObject", the code that does this is as below.
Quote
procedure TjanHTMLParser.GetParsedLines(alist:TStringlist);
var
  s:string;
  j,i:integer;
  obj:TObject;
  HTMLTag:THTMLTag;
  HTMLParam:THTMLParam;
begin
  for i:= 1 to parsed.count do
  begin
   obj:=(parsed[i-1]);
I found info regarding typecasting but I don't understand what is meant, any help would be appreciated.
All things considered insanity seems the best option

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Error: Incompatible types:got Pointer expected TOBject
« Reply #1 on: December 07, 2009, 04:48:47 am »
I believe it happens on this line:
Code: [Select]
obj:=(parsed[i-1]);What's the type of parsed? I guess it's a TList or something similar that stores pointers. Perhaps you can use typecasting like this:
Code: [Select]
obj:=TObject(parsed[i-1]);

davesimplewear

  • Sr. Member
  • ****
  • Posts: 319
    • Davids Freeware
Re: Error: Incompatible types:got Pointer expected TOBject
« Reply #2 on: December 07, 2009, 06:19:31 am »
Thanks Leledumbo,

You are correct, it does break at that point, so I will try to typecast as you suggested and see if that works.
All things considered insanity seems the best option

 

TinyPortal © 2005-2018