View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002188 | JEDI VCL | 00 JVCL Components | public | 2004-09-30 23:06 | 2004-10-08 02:00 |
Reporter | anonymous | Assigned To | user72 | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 BETA 2 | ||||
Target Version | Fixed in Version | 3.00 RC 1 | |||
Summary | 0002188: JvDBImage issue | ||||
Description | Double click or press <Enter> on JvDBImage. Try to scroll on another record of database. Exception: Dataset not in edit or insert state (even if JvDBImage is read-only). | ||||
Additional Information | Src: procedure TJvDBImage.UpdateData(Sender: TObject); var Stream: TMemoryStream; begin CheckFieldType; // If there is no graphic just clear field and exit if Picture.Graphic = nil then begin Field.Clear; Exit; end; Stream := TMemoryStream.Create; try Picture.Graphic.SaveToStream(Stream); Stream.Position := 0; // Exception here: TBlobField(Field).LoadFromStream(Stream); finally Stream.Free; end; end; ----------------------------- Standard DBImage hasn't such bug (even if it is _not_ read-only). | ||||
Tags | No tags attached. | ||||
|
Does the following work: procedure TJvDBImage.UpdateData(Sender: TObject); var Stream: TMemoryStream; begin if ReadOnly then Exit; // add this line CheckFieldType; ... |
|
>Does the following work: > ... > if ReadOnly then Exit; // add this line > ... Yes, it works but (as I said in my report):"Standard DBImage hasn't such bug (even if it is _not_ read-only)". Why it works in standard DBImage? I don't know... Can anyboby give an answer? |
|
> Standard DBImage hasn't such bug (even if it is _not_ read-only). Standard DBImage relies on the datalink field to do the right thing. Since we don't really know whether the images are the same (without reading a potentionally large stream from the database and compare it to the current image), the only option is to save the image every time. If you don't want that, set ReadOnly to true and add the code in UpdateData as suggested. |
|
Here is a solution (compare it with borland TDBImage.LoadPicture). ------------------------------- procedure TJvDBImage.LoadPicture; begin // add this line if not FPictureLoaded then try Picture.Graphic := CreateGraphic; except Picture.Graphic := nil; raise; end; end; Now all work perfectly. ---------------------- Read-only is bad way. 1) If I want to modify a picture I must flip ReadOnly every time ... 2) It's not object oriented. > Since we don't really know whether the images are the same No. TPicture tracks out changes itself (remember OnChange event). ---------------------- Best regards, Alex. edited on: 10-06-04 23:56 |
|
Ah, that explains it. I was certain that line was already in there but I never looked. OK, if that solves, I'll update it in CVS |
|
Updated in CVS. Thanks for the fix. |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-09-30 23:06 | anonymous | New Issue | |
2004-10-05 00:22 |
|
Note Added: 0005305 | |
2004-10-05 00:22 |
|
Status | new => feedback |
2004-10-06 02:26 | anonymous | Note Added: 0005323 | |
2004-10-06 07:11 |
|
Note Added: 0005324 | |
2004-10-06 23:11 | anonymous | Note Added: 0005330 | |
2004-10-06 23:56 | anonymous | Note Edited: 0005330 | |
2004-10-07 05:31 |
|
Note Added: 0005331 | |
2004-10-08 02:00 |
|
Status | feedback => resolved |
2004-10-08 02:00 |
|
Resolution | open => fixed |
2004-10-08 02:00 |
|
Assigned To | => user72 |
2004-10-08 02:00 |
|
Note Added: 0005347 |