Category: Firemonkey

How can I clean up lines, drawn by a FMX TScrollBox Bug, outside of TScrollBox?

In my main application I'm experiencing a bug with FMX TScrollBox. While scrolling down in the scrollbox, the TNumberbox leaves behind lines in other components. Even after repainting/updating the other components (with the lines) the lines aren't cleaned up. To clarify I made a dummy application: image Component breakdown I understand that there's probably no way to get rid of the bug. However I would like to know how I can clean up the lines in my application. Anyone that can help?
Read More

Get my Firemonkey app (Tokyo R3) to deploy to my test device

I have a test app I've built with FireMonkey (Tokyo 10.2 R3). It builds fine and deploys for Android and seem build find for iOS (no errors in the build portion anyway). When it finally tries to deploy to my device (iPhone 6s Plus - 64bit - iOS11), the deploy process ends in a "e8000067" error, with nothing added to the phone. The certificates appear to be fine (occasionally I get an "e8008015" error, but looking at them in the Provisioning Page seems to make that error go away). Else where I see indications that e8000067 could relate to trying to install a 64bit version on a 32 bit device. But this is certainly a 64bit phone. How can I get past this error and deploy to my test device.
Read More

Delphi FMX – Android API 26 – SQLite DB Connection with UNIDAC

i'm using Tokyo 10.2.3 and UNIDAC component for interacting with a sqlite database on Adroid API 26 Platform. So far, with the help from Dave: http://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/ ... the App worked fine with with access to 'TakePhoto', 'Positioning', 'W/R to external storage' ... The UNIDAC MySQL Connection is working too, but seems to need no further permissions. But I can get no connection to my SQLite Database anymore. Before the change from SDK14 to SDK26 the connection worked fine. Seems to me, as it is a problem with accessing 'external' URIs as Dave described in his blog. I changed the Manifest.xml, added a fileprovider and added the provider_paths.xml too. The way of choose the Databasefile with UNIDAC as String: SQLiteConnection1.Database := TPath.Combine( TPath.GetDocumentsPath, 'test.db' ); Any solutions or help outside ? thanks a lot Manu
Read More

Tamil Language (தமிழ்) text was not displaying properly in Android mobile app using Firemonkey

I'm using Delphi 10.1 for developing android mobile application and I have tried to display Tamil language (தமிழ்) texts in TLabel and TComboBox and it was properly in windows application but it was not displaying properly in android mobile app and should need to add any specific font to display this language. Please help me to fix this.
Read More

Delphi FMX and Indy on OSX returns socket errors, but not on PC

When I compile the following code with Windows as target, it loads the site fine, compiling it for OSX 10.12.x, Indy return a Socket Error # 54. On OSX 10.13 High Sierra, the same code works fine. After days of trying, I just cant figure it out. Does anybody has any clue for me? I am using Delphi 10.2 Tokyo. id:=TIdHTTP.Create(nil); ssl:=TIdSSLIOHandlerSocketOpenSSL.Create(id); id.IOHandler:=ssl; id.HTTPOptions:=[hoWantProtocolErrorContent,hoNoProtocolErrorException]; id.RedirectMaximum:=5; id.ReadTimeout:=30000; id.HandleRedirects:=true; ssl.SSLOptions.SSLVersions:=[sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2,sslvSSLv2,sslvSSLv23,sslvSSLv3]; s:=id.Get('https://www.fleurtygirl.net/'); ssl.Free; id.free;
Read More

Firemonkey TCameraComponent quality change when reactivated

I'm building a barcode reader application in Delphi 10.1 Berlin with firemonkey for Android. Based on the CameraComponent sample and using the ZXing library, it was possible to read the barcode. To initialize the camera, I'm using this code: procedure TfrmMain.btnOpenReaderClick(Sender: TObject); begin CameraComponent.Active := False; CameraComponent.FocusMode := FMX.Media.TFocusMode.ContinuousAutoFocus; CameraComponent.Quality := TVideoCaptureQuality.MediumQuality; CameraComponent.Active := True; CameraComponent.SampleBufferToBitmap(imgCamera.Bitmap, True); end; To scan the barcode, I'm running this: procedure TfrmMain.GetImage; var ReadResult: TReadResult; begin CameraComponent.SampleBufferToBitmap(imgCamera.Bitmap, True); if (FScanInProgress) then Exit; { This code will take every 4 frames. } inc(FFrameTake); if (FFrameTake mod 4 <> 0) then Exit; ReadResult := nil; ITask(TTask.Create( procedure begin try FScanInProgress := True; ReadResult := FScanManager.Scan(imgCamera.Bitmap); TThread.Synchronize(nil, procedure begin try if (ReadResult <> nil) then begin Label1.Text := ReadResult.text; CameraComponent.Active := False; end; except on E: Exception do ShowMessage(E.Message); end; end); finally ReadResult.Free; imgCamera.Bitmap.Free; FScanInProgress := false; end; end)).Start; end; After reading the barcode, when I set CameraComponent.Active := True; to start reading a new barcode, the CameraComponent quality is automatically set to high quality, even if the property is set as medium quality when starting the component. This causes the preview of the camera to show at low frame rate. Is there a way to set the default capture setting to medium when reactivating the CameraComponent?
Read More

LLVM header error: no member named ‘xxxxxx’ in the global namespace (iOS, C++Builder)

Environment description: I'm using RAD Studio 10.2.3 Tokyo with all hotfixes installed, XCode 9.4.1, macOS High Sierra 10.13.6, iOS SDK 11.4, PAServer 10.3.1.10. Problem: When I try to compile a blank application for iOS 32-bit, it is successful, and the application runs on my device. But, if I include <cmath>, then during compilation I get these errors: [bcciosarm Error] cmath(313): no member named 'signbit' in the global namespace [bcciosarm Error] cmath(314): no member named 'fpclassify' in the global namespace [bcciosarm Error] cmath(315): no member named 'isfinite' in the global namespace [bcciosarm Error] cmath(316): no member named 'isinf' in the global namespace [bcciosarm Error] cmath(317): no member named 'isnan' in the global namespace [bcciosarm Error] cmath(318): no member named 'isnormal' in the global namespace [bcciosarm Error] cmath(319): no member named 'isgreater' in the global namespace [bcciosarm Error] cmath(320): no member named 'isgreaterequal' in the global namespace [bcciosarm Error] cmath(321): no member named 'isless' in the global namespace [bcciosarm Error] cmath(322): no member named 'islessequal' in the global namespace [bcciosarm Error] cmath(323): no member named 'islessgreater' in the global namespace [bcciosarm Error] cmath(324): no member named 'isunordered' in the global namespace [bcciosarm Error] cmath(325): no member named 'isunordered' in the global namespace I've searching something about and I found this: https://forums.developer.apple.com/thread/87814 Which is the same error and it's due to "if you combine isysroot & isystem" In the same way, I found a related topic in SO: Missing/wrong headers iOS 11.3 SDK I would like to know, how can I fix this problem? A suggested answer is not to use isysroot & isystem together, but the command options are automatically generated by the IDE during compilation. So, if you have a fix or workaround to solve this, please let me know. Minimal and verifiable code: Just create a blank application in C++Builder and include the <cmath> header in your mainform.cpp.
Read More

BeginUpdate/Endupdate block with add or remove of child objects : misconception in delphi?

This question follow this one: Why this change in tokyo 10.2.3? and introduce what i think is a misconception in delphi Basically in firemonkey you have the methods BeginUpdate and EndUpdate that permit you to deactivate/activate the realign of a control when you update it. Instead of realigning several time the control every time you change one of it's properties, you do it only one time at the end when you call EndUpdate below the implementation of those functions: procedure TControl.BeginUpdate; var I: Integer; begin if FUpdating = 0 then DoBeginUpdate; Inc(FUpdating); if FControls <> nil then for I := 0 to FControls.Count - 1 do FControls[I].BeginUpdate; end; procedure TControl.EndUpdate; var I: Integer; begin if IsUpdating then begin if FControls <> nil then for I := 0 to FControls.Count - 1 do FControls[I].EndUpdate; Dec(FUpdating); if not IsUpdating then begin DoEndUpdate; RefreshInheritedCursorForChildren; end; end; end; procedure TControl.DoBeginUpdate; begin end; procedure TControl.DoEndUpdate; begin Realign; end; note (it's important) those functions are VIRTUAL, so you can override their behavior, like what TGrid did : procedure TCustomGrid.DoBeginUpdate; begin if Model <> nil then Model.BeginUpdate; inherited; end; procedure TCustomGrid.DoEndUpdate; begin inherited; if Model <> nil then Model.EndUpdate; end; OK now the problem, and i think it's a misconception, when you update the properties of a control inside a BeginUpdate/EndUpdate block, often you also add some child controls (or remove some). the problem is the way the procedure TControl.DoAddObject(const AObject: TFmxObject); and procedure TControl.DoRemoveObject(const AObject: TFmxObject); are implemented, to resume procedure TControl.DoAddObject(const AObject: TFmxObject); begin ... if AObject is TControl then begin AsControl := TControl(AObject); AsControl.FUpdating := FUpdating; end ... end; and procedure TControl.DoRemoveObject(const AObject: TFmxObject); procedure ResetUpdatingState(const AObject: TFmxObject); var I: Integer; begin if AObject is TControl then TControl(AObject).FUpdating := 0; for I := 0 to AObject.ChildrenCount - 1 do ResetUpdatingState(AObject.Children[I]); end; begin .... ResetUpdatingState(AObject); .... end; as you understand, when you add a child to a control then you set it's FUpdating to the same value of the new parent control (and you also don't fire any BeginUpdate/EndUpdate event so what happen with control like Tgrid?). you are not touching the FUpdating of the childs of this child control leaving them in an highly probably wrong state when you remove a child control, then you set it's FUpdating to zero, and same for all it's childs (so different behavior than when you add). but here also you don't fire any BeginUpdate/EndUpdate event So is this a misconception or is there any reason to do it like that? I think a good way must be to do : procedure TControl.DoAddObject(const AObject: TFmxObject); begin ... if AObject is TControl then For i := 1 to FUpdating do TControl(AObject).BeginUpdate; ... end; and procedure TControl.DoRemoveObject(const AObject: TFmxObject); begin .... if AObject is TControl then For i := 1 to FUpdating do TControl(AObject).EndUpdate; .... end; But not sure if I didn't miss something ...
Read More

E2026 or W1023 – take your pick (:

[WayBack] A compiler curiosity I’ve learned today … – David Berneda – Google+: depending on if TEST is defined or not, you get E1026 or W1023. // This works: {$IF Declared(Test) and (Test>=100)} {$ENDIF} // This not: {$IF Declared(Test)} {$IF Test>=100} // "E2026 Constant expression expected" {$ENDIF} {$ENDIF} The W1023 can be alleviated by replacing 100 with +100. Note that both errors have been documented since at least Delphi 2007: [WayBack] W1023: Comparing signed and unsigned types – widened both operands [WayBack] Constant expression expected (E2026) –jeroen Source: A compiler curiosity I’ve learned today: // This works: {$IF Declared(Test) …
Read More

Why this change in tokyo 10.2.3?

in tokyo 10.2.3 they change this code in firemonkey fmx.controls.pas : procedure TControl.DoRemoveObject(const AObject: TFmxObject); var LParent: TFmxObject; NeedUpdate: Boolean; TabStop: IControl; AsControl: TControl; begin DisableDisappear := True; try inherited; if (FTabList <> nil) and Supports(AObject, IControl, TabStop) then GetTabList.Remove(TabStop); NeedUpdate := False; if not (csDestroying in ComponentState) then begin LParent := Parent; while (LParent <> nil) and (not (LParent is TCommonCustomForm)) do LParent := LParent.Parent; NeedUpdate := LParent <> nil; end; if AObject is TControl then AsControl := TControl(AObject) else AsControl := nil; if AsControl <> nil then begin if FControls <> nil then FControls.Remove(AsControl); AsControl.FUpdating := 0; RepaintJointArea(AObject); AsControl.SetNewScene(nil); if NeedUpdate and (AsControl.Align <> TAlignLayout.None) then Realign; end; if AObject is TEffect then begin RemoveFromEffectsList(TEffect(AObject)); if NeedUpdate then begin Repaint; RecalcHasEffect; end; end; if AsControl <> nil then begin if NeedUpdate then ChildrenAlignChanged; if AsControl.TempCanvas <> nil then AsControl.TempCanvas := nil; if AsControl.FInPaintTo then AsControl.FInPaintTo := False; end; finally DisableDisappear := False; end; end; by this code procedure TControl.DoRemoveObject(const AObject: TFmxObject); procedure ResetUpdatingState(const AObject: TFmxObject); var I: Integer; begin if AObject is TControl then TControl(AObject).FUpdating := 0; for I := 0 to AObject.ChildrenCount - 1 do ResetUpdatingState(AObject.Children[I]); end; var LParent: TFmxObject; NeedUpdate: Boolean; TabStop: IControl; AsControl: TControl; begin DisableDisappear := True; try inherited; if (FTabList <> nil) and Supports(AObject, IControl, TabStop) then GetTabList.Remove(TabStop); NeedUpdate := False; if not (csDestroying in ComponentState) then begin LParent := Parent; while (LParent <> nil) and (not (LParent is TCommonCustomForm)) do LParent := LParent.Parent; NeedUpdate := LParent <> nil; end; if AObject is TControl then AsControl := TControl(AObject) else AsControl := nil; ResetUpdatingState(AObject); if AsControl <> nil then begin if FControls <> nil then FControls.Remove(AsControl); RepaintJointArea(AObject); AsControl.SetNewScene(nil); if NeedUpdate and (AsControl.Align <> TAlignLayout.None) then Realign; end; if AObject is TEffect then begin RemoveFromEffectsList(TEffect(AObject)); if NeedUpdate then begin Repaint; RecalcHasEffect; end; end; if AsControl <> nil then begin if NeedUpdate then ChildrenAlignChanged; if AsControl.TempCanvas <> nil then AsControl.TempCanvas := nil; if AsControl.FInPaintTo then AsControl.FInPaintTo := False; end; finally DisableDisappear := False; end; end; to resume they simply add procedure ResetUpdatingState(const AObject: TFmxObject); var I: Integer; begin if AObject is TControl then TControl(AObject).FUpdating := 0; for I := 0 to AObject.ChildrenCount - 1 do ResetUpdatingState(AObject.Children[I]); end; to replace AsControl.FUpdating := 0; So they set now FUpdating:=0 to all the childreens of the controls I can't understand why they do so and with bug they want to correct by doing this ? My application is completely broken because of this change ... In the code i use that is broken now I first do: aControl.beginupdate try .... aChildControl.parent := nil; .... finally aControl.endupdate end; and later i do aControl.beginupdate try .... aChildControl.parent := aControl; .... finally aControl.endupdate end; before this was working because in both variant the fupdating of childs of aChildControl didn't change by doing aChildControl.parent := nil; or aChildControl.parent := aControl;, but now with this 10.2.3 then fupdating of all the childs of aChildControl will be set to zero in aChildControl.parent := nil; and later when you do aControl.beginupdate try .... aChildControl.parent := aControl; .... finally aControl.endupdate end; here the FUpdating will not be updated to reflect the new parent fupdating and thus will be 0 (in 10.2.2 it's was 1) and when later you do aControl.endupdate then you will decrease the FUpdating and it's will now become -1 Fupdating is important because it's raise the endupdate/beginupdate event In generale i think it's a bad behavior when removing a child object to hardly set it's fupdating to zero. Instead we must call ChildObject.endupdate the same amount of time of fupdating, this because endupdate can be overriden like in TText where you call TTextLayout.endupdate in TText.endupdate
Read More