Hello, to search and display information about a product I have the following scenario:
- a form from where a form is opened with a preview camera and a barcode scanner component:
FCamera: = TFCamera.Create (nil);
FCamera.OnReadCode: = ReturnOkCodigo;
TfgAnimationHelper.ShowForm (FCamera);
- in the form where the image is captured and scanned, I have an accept button that executes this CloseForm (true) code:
procedure TFCamera.CloseForm (OK: boolean);
begin
if OK and Assigned (FOnReadCode) and (fgLabCode.Text <> '-') then FOnReadCode (fgLabCode.Text);
TfgAnimationHelper.HideForm (Self, [TfgAnimationOption.ReleaseOnFinish]);
FCamera: = nil;
end;
The FOnReadCode event helps me to retrieve the code that has been read. This works fine executing like this on click button : CloseForm(true); , but if I use a configuration flag (TConfig.JO.B ['closeonread']) to close the form automatically when a barcode is identified, with this code, a memory error occurs (attach log file):
procedure TFCamera.fgBarcodeScanDetected (Sender: TObject;
const ABarcodes: TArray <FGX.Scanner.Barcode.TfgBarcode>);
begin
fgLabCode.Text: = ParseaCodigo (ABarcodes [0] .RawData); //. SubString (HOST_FULL.Length);
if TConfig.JO.B ['closeonread'] then CloseForm (true) else
begin
TThread.ForceQueue (nil, procedure begin
fgBarcodeScan.Active: = False;
end);
end;
end;
error_camera_preview.txt