Subject RE: [IBO] Ib_JpegImage, and Ctrl Grid .. asign appears to be the problem
Author Jason Wharton

I vaguely recall trying to get this control to work in the TIB_CtrlGrid in
the past and unfortunately I remember more clearly now that it was
considered by me at the time a "lost cause". I don't remember why but when
I look at it in a bit I'll probably remember why.

I'll warn you that the performance of this control may not be all that
desirable when using JPEG. The stock control grid I based mind off of is
fraught with problems and inefficiencies. I'm not excited to get into the
guts of this control when I am so pressured to get IBO 4.7 released.


> -----Original Message-----
> From: []On
> Behalf Of Adrian Wreyford
> Sent: Thursday, December 21, 2006 2:30 AM
> To:
> Cc: jwharton@...
> Subject: [IBO] Ib_JpegImage, and Ctrl Grid .. asign appears to be the
> problem
> Dear Jason, anybody with free time!
> OK So I'm desperate.. I've been at it for 4.5 hours now solid, just
> debugging the test I sent you.
> I removed the datasource for all the other JpegImages in the test
> example to make the debugging easier, else have to follow all their
> drawing aswell.
> When your scroll the dataset, so that the second column of
> the ctrl grid
> also has data assigned to it, the Ctrlpanel creates the new
> tWincontrol,
> then from the buffer, it assigns the new buffer links:
> RefreshDataLinks( FPanel ); (IB_CGrid:1154)
> The first one is loaded, and assigned properly, but the
> second image, is
> not .. it sees it as a bitmap, for some or other unknown reason, so
> branches incorrectly.
> In IB_Components (45042):
> procedure TIB_ColumnBlob.AssignTo( Dest: TObject );
> begin
> if Dest is TIB_ColumnBlob then
> SaveToBlob(TIB_ColumnBlob( Dest ))
> else
> if Dest is TStrings then
> SaveToStrings(TStrings(Dest))
> else
> if Dest is TStream then
> SaveToStream(TStream(Dest))
> else
> if Dest is TGraphic then
> SaveToGraphic(TGraphic(Dest))
> else
> if Dest is TPicture then
> begin
> if Assigned( TPicture(Dest).Graphic ) then
> SaveToGraphic(TPicture(Dest).Graphic) <--first time
> goes through
> here! (for first image.)
> else
> SaveToGraphic(TPicture(Dest).Bitmap); <--for second image
> through here! (why I don't know!!)
> end
> else
> inherited AssignTo( Dest );
> The very first time you run the program, and only one record, then no
> assining happens, thus TIB_ColumnBlob.AsignTo only called
> when recordset
> scrolled, and more than one record now! Perhaps this is as the new
> IB_JpegImage is created dynamically as with all the controls
> dropped on
> the IB_Grid for the 2nd on rows!. Now the problem arrises
> when assigning
> to dynamically created controls at runtime.
> So first time the CtrlGrid WMPaint creates the "bitmap", then it is
> drawn in TIB_CustomJPEGImage.Paint;
> Then when one scrolls, (now two records, thus two columns need to be
> drawn with jpeg images in), the buffer pointers are advanced, and then
> we get the AsignTo call, that incorrectly branches to
> SaveToGraphic(TPicture(Dest).Bitmap); resulting in the error.
> Perhaps this has something to do with the way blob columns are handled
> in the buffer?? ? cached updates IB_Components line 24578?
> I'll keep on trying, but my free time is running out, and I'm not so
> sure the problem lies with the freeware IB_JPEGImage of Tomas, but
> rather with the way the ctrlgrid handles blob columns.
> PLEASE give it a morsel of attention.!
> Adrian
> end;