Loading bitmap failed when a TField is of the TWideStringFie

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Loading bitmap failed when a TField is of the TWideStringFie

Post by REH Outsourcing » Fri Mar 16, 2018 5:07 pm

Delphi version: Seattle and Tokyo
TTeeGrid version: VCL & FMX Registered version-1.04
Multidevice Application (FMX)
Platform: WIN32

Good afternoon,

The problem is the following, when I assign a TDataSet to a TTeeGrid, using this method
  TeeGrid1.Data: = TVirtualDBData.From (FDMemTable1);
if the TDataSet has any field of the TWideMemoField class, when calling the method TVirtualDBData.AsString, it considers that it contains an image (when that class can only contain text) and the next exception is raised, "Loading bitmap failed" (This happens specifically when calling SetBlobPicture (tmp).

SOLUTION:
The solution is to discriminate which descendants of TBlobField, can contain an image.

For your TFieldType the following, do not contain an image
ftMemo, ftFmtMemo, etc.
These classes can not contain an image either.
TMemoField, TWideMemoField etc.

If this were not enough, SetBlobPicture (), would have to evaluate if TBlobField contains a valid image and does not raise an exception, in case it does not contain a valid image.

Below I show you the trace obtained with MadExcept, in case it could help you.

date/time : 2018-03-16, 14:05:05, 893ms
computer name : SURFFACEREH
user name : Ricardo
operating system : Windows 10 Tablet PC x64 build 16299
system language : Spanish
system up time : 14 days
program up time : 7 minutes 8 seconds
processors : 4x Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
physical memory : 3189/8097 MB (free/total)
free disk space : (C:) 69,25 GB
display mode : 1920x1080, 32 bit
process id : $3440
allocated memory : 83,04 MB
largest free block : 1,20 GB
executable : Project1.exe
exec. date/time : 2018-03-16 13:57
version : 1.0.0.0
compiled with : Delphi 10 Seattle
madExcept version : 4.0.17
callstack crc : $f02d2ad7, $4c1b8726, $4c1b8726
count : 3
exception number : 1
exception class : EBitmapLoadingFailed
exception message : Loading bitmap failed.

main thread ($29d0):
005c935a +1ba Project1.exe FMX.Graphics 3577 +30 TBitmap.LoadFromStream
009ad967 +0c3 Project1.exe Data.DB 8935 +13 TBlobField.SaveToStreamPersist
009acfee +04a Project1.exe Data.DB 8630 +4 TBlobField.AssignTo
00528623 +007 Project1.exe System.Classes 5390 +0 TPersistent.Assign
005c7f20 +080 Project1.exe FMX.Graphics 3196 +14 TBitmap.Assign
00f476f0 +054 Project1.exe Tee.GridData.DB 315 +6 GetPicture

00f4772c +030 Project1.exe Tee.GridData.DB 327 +7 SetBlobPicture
00f477ce +076 Project1.exe Tee.GridData.DB 351 +15 TVirtualDBData.AsString

00f50098 +040 Project1.exe Tee.Grid.Rows 1306 +1 PaintColumn
00f50206 +0c2 Project1.exe Tee.Grid.Rows 1334 +12 PaintColumns
00f50233 +01b Project1.exe Tee.Grid.Rows 1341 +3 TRows.PaintRow
00f4f3d6 +0c6 Project1.exe Tee.Grid.Rows 899 +25 PaintByRows
00f4f9a5 +081 Project1.exe Tee.Grid.Rows 1095 +21 TRows.Paint
00f56937 +05b Project1.exe Tee.Grid.RowGroup 877 +8 PaintRows
00f56a4a +0da Project1.exe Tee.Grid.RowGroup 905 +18 TRowGroup.Paint
00f5a37b +087 Project1.exe Tee.Grid 830 +8 TCustomTeeGrid.Paint
00f5fc3a +08e Project1.exe FMXTee.Grid 1275 +16 TTeeGrid.Paint
00703336 +1a2 Project1.exe FMX.Controls 3004 +14 DoPaintInternal
00703596 +146 Project1.exe FMX.Controls 3029 +9 PaintAndClipChild
007036d4 +064 Project1.exe FMX.Controls 3053 +7 TControl.PaintInternal
0094c25a +226 Project1.exe FMX.Forms 5895 +44 TCustomForm.PaintRects
008c28ee +2a2 Project1.exe FMX.Platform.Win 1441 +44 WMPaint
008c41b3 +477 Project1.exe FMX.Platform.Win 2066 +77 WndProc
77c7fba6 +016 user32.dll CallWindowProcW
77e60bcb +04b ntdll.dll KiUserCallbackDispatcher
74e32d3a +00a win32u.dll NtUserDispatchMessage
77c88c1b +00b user32.dll DispatchMessageW
008c074c +02c Project1.exe FMX.Platform.Win 669 +8 TPlatformWin.HandleMessage
0093de8b +03b Project1.exe FMX.Forms 1764 +3 TApplication.HandleMessage
008c0597 +033 Project1.exe FMX.Platform.Win 622 +5 TPlatformWin.Run
0093fc51 +05d Project1.exe FMX.Forms 2091 +7 TApplication.Run
00f7f1b7 +03b Project1.exe Project1 23 +3 initialization
74d68652 +022 KERNEL32.DLL BaseThreadInitThunk

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Loading bitmap failed when a TField is of the TWideStringFie

Post by Marc » Tue Mar 27, 2018 12:13 pm

We are looking at this and will get back to this thread.

Regards,
Marc Meumann
Steema Support

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Loading bitmap failed when a TField is of the TWideStringFie

Post by Marc » Thu May 24, 2018 11:56 am

Hello,

Thank you very much for your contribution and sorry to take so long to get back on this issue. A fix will be written into the next update of the code.

Regards,
Marc

REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Re: Loading bitmap failed when a TField is of the TWideStringFie

Post by REH Outsourcing » Wed Jun 06, 2018 11:50 am

Hello Marc,

I just tried the patch, and everything seems to work correctly.

Regards.

Post Reply