Recent

Author Topic: [Solved] Problem with TBitmap.Create in Windows  (Read 6956 times)

eric

  • Sr. Member
  • ****
  • Posts: 267
[Solved] Problem with TBitmap.Create in Windows
« on: August 08, 2012, 08:40:32 pm »
I have a Lazarus program which was developed in Linux and functions correctly, and I'm trying to port it to Windows. The Lazarus version is 0.9.30.4 in both cases.

This is a snippet of the code:

Code: [Select]
var
  ABitmap: TBitmap;
..
begin
..
 ABitmap := TBitmap.Create;
..
end;

When I try to build the program it stops with the cursor at the start of 'Create' and shows the message:

Error: identifier idents no member "Create"

What's happening?
« Last Edit: August 08, 2012, 09:24:21 pm by eric »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Problem with TBitmap.Create in Windows
« Reply #1 on: August 08, 2012, 08:45:01 pm »
Check your uses clause make sure that TBitmap refers to the one in graphics unit and not in some other unit like windows to make sure ctrl+click on the TBitmap name and see which unit it opens.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Problem with TBitmap.Create in Windows
« Reply #2 on: August 08, 2012, 08:50:13 pm »
The windows unit contains a TBitmap structure. So be explicit and use
Code: [Select]
ABitmap := Graphics.TBitmap.Create;

Edit: and the same for the var declaration:
Code: [Select]
var
  ABitmap: Graphics.TBitmap;
« Last Edit: August 08, 2012, 08:52:05 pm by ludob »

eric

  • Sr. Member
  • ****
  • Posts: 267
Re: Problem with TBitmap.Create in Windows
« Reply #3 on: August 08, 2012, 09:23:19 pm »
Thanks both of you for your very quick answers. That has fixed the problem.

 

TinyPortal © 2005-2018