Recent

Author Topic: Bad Hint related to TLazIntfImage  (Read 595 times)

jipété

  • Full Member
  • ***
  • Posts: 150
Bad Hint related to TLazIntfImage
« on: May 23, 2024, 08:52:35 am »
Hello,

When I move the mouse over that word, a big window hint is displayed with a piece of code, code which doesn't compile anymore due to the fact that GetDescriptionFromDevice is badly used : should be IntfImg1.DataDescription := GetDescriptionFromDevice(0);

See the last line in the attached image.

Thank you for the correction.

paweld

  • Hero Member
  • *****
  • Posts: 1050
Re: Bad Hint related to TLazIntfImage
« Reply #1 on: May 23, 2024, 09:10:48 am »
Best regards / Pozdrawiam
paweld

jipété

  • Full Member
  • ***
  • Posts: 150
Re: Bad Hint related to TLazIntfImage
« Reply #2 on: May 23, 2024, 09:50:53 am »

wp

  • Hero Member
  • *****
  • Posts: 12067
Re: Bad Hint related to TLazIntfImage
« Reply #3 on: May 23, 2024, 04:36:36 pm »

dsiders

  • Hero Member
  • *****
  • Posts: 1146
Re: Bad Hint related to TLazIntfImage
« Reply #4 on: May 23, 2024, 07:37:48 pm »
I have changed the example code (based on @wp's suggestions) to:

Code: Pascal  [Select][+][-]
  1. var
  2.   BmpHnd,MaskHnd: HBitmap;
  3.   Bitmap1: TBitmap;
  4.   IntfImg1: TLazIntfImage;
  5.   Reader: TLazReaderXPM;
  6. begin
  7.   // create a bitmap (or use an existing one)
  8.   Bitmap1:=TBitmap.Create;
  9.   // create the raw image
  10.   IntfImg1:=TLazIntfImage.Create(0,0);
  11.   // get the description for the current screen (bitsperpixel, depth, ...)
  12.   IntfImg1.DataDescription := GetDescriptionFromDevice(0);
  13.   // create the XPM reader
  14.   Reader:=TLazReaderXPM.Create;
  15.   // load the image
  16.   IntfImg1.LoadFromFile('filename.xpm',Reader);
  17.   // create the bitmap handles
  18.   IntfImg1.CreateBitmaps(BmpHnd,MaskHnd);
  19.   // apply handles to the Bitmap1
  20.   Bitmap1.Handle:=BmpHnd;
  21.   Bitmap1.MaskHandle:=MaskHnd;
  22.   // clean up
  23.   Reader.Free;
  24.   IntfImg1.Free;
  25.   // do something with the Bitmap1
  26.   // ...
  27. end;
  28.  

Let me know if there are any other changes needed.

Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

 

TinyPortal © 2005-2018