delphi-10.1-berlin

What is the correct way to structure this generic object creation

白昼怎懂夜的黑 提交于 2020-01-06 19:45:35
问题 Ignoring the fact that this uses the Aurelius Framework, this question is more about how I need to re-tweak the code to make the generic constructor injection work for both type: < string > and < TCustomConnection > Also ignore the fact that the child objects are in the same unit, I would generally put them in their own, but this just makes it easier to post in a question. I'm trying use the Factory Method pattern to determine what type of connection it should be making at runtime depending

Could not Create Output file in Delphi 10.1 Berlin

泪湿孤枕 提交于 2020-01-05 05:29:04
问题 When running my Delphi Project for the first time , it runs with no error. But the subsequent runs produces an error below: [dcc32 Fatal Error] F2039 Could not create output file '.\Win32\Debug\Project1_p.exe' I tried enabling my application Experience and setting it to automatic, as stated here with no luck. How to fix this permanently? Im using Delphi 10.1 Berlin. UPDATE 1: I know deleting the .exe, checking whether the executable is still running in the task manager and killing the process

Change the regional settings format for Sysem.Variants.VarToWideStr

孤者浪人 提交于 2020-01-04 09:36:25
问题 A third party component (FastReports) on my application is using extensively the System.Variants.VarToWideStr function, which is fine except that it ignores the regional settings I need that application to use. Example: FormatSettings.ShortDateFormat := 'dd/mm/yyyy'; ShowMessage(VarToWideStr(Date)); FormatSettings.ShortDateFormat := 'yyyy/mm/dd'; ShowMessage(VarToWideStr(Date)); This code always returns the same string, ignoring the regional settings that I indicate the application to use. Do

Fmx TStringGrid row color

℡╲_俬逩灬. 提交于 2020-01-04 05:49:07
问题 I have a problem in Delphi 10.1 in a multi-device application (on Windows). I have a StringGrid (connected to a db) and I can change background color of row, but the problem is there is a "padding" (in grey/silver) between cells. In onformCreate I define: stringgrid1.DefaultDrawing := False; This is my code: procedure Tlist_form.StringGrid1DrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF; const Row: Integer; const Value: TValue; const State:

Dealing with circular strong references in Delphi

我的梦境 提交于 2019-12-30 18:33:52
问题 I got two classes (in my example TObject1 and TObject2) which know each other via interfaces (IObject1, IObject2). As you probably know in Delphi this will lead to a memory leak as both reference counter will always stay above zero. The usual solution is declaring one reference as weak. This works in most cases because you usually know which one will be destroyed first or don't necessarily need the object behind the weak reference once it is destroyed. This said I tried to solve the problem

How to access private methods without helpers?

我的未来我决定 提交于 2019-12-27 17:31:56
问题 In Delphi 10 Seattle I could use the following code to work around overly strict visibility restrictions. How do I get access to private variables? type TBase = class(TObject) private FMemberVar: integer; end; And how do I get access to plain or virtual private methods? type TBase2 = class(TObject) private procedure UsefullButHidden; procedure VirtualHidden; virtual; procedure PreviouslyProtected; override; end; Previously I would use a class helper to break open the base class. type

How to access private methods without helpers?

不羁的心 提交于 2019-12-27 17:31:13
问题 In Delphi 10 Seattle I could use the following code to work around overly strict visibility restrictions. How do I get access to private variables? type TBase = class(TObject) private FMemberVar: integer; end; And how do I get access to plain or virtual private methods? type TBase2 = class(TObject) private procedure UsefullButHidden; procedure VirtualHidden; virtual; procedure PreviouslyProtected; override; end; Previously I would use a class helper to break open the base class. type

Strange EOutOfMemory exception using TStringList

柔情痞子 提交于 2019-12-25 09:32:44
问题 I have a system that loads some text files that are zipped into a ".log" file and parse then into informational classes using multiple threads that each deals with a different file and adds the parsed objects to a list. The file is loaded using TStringList, since it was the fastest method that I tested. The number of text files is variable but normally I have to deal with something between 5 to 8 files ranging from 50Mb to 120Mb in one incursion. My problem: The user can load the .log files

Sharing functionality issue for FaceBook app using Delphi 10.1 Berlin

孤街浪徒 提交于 2019-12-25 07:48:30
问题 I'm using Delphi 10.1 Berlin for developing android apps and for this I have tried to implement sharing functionality using the following code: procedure TBaseForm.ShareDataInAndroid; var Intent: JIntent; begin try Intent := TJIntent.Create; Intent.setType(StringToJString('text/plain')); Intent.setAction(TJIntent.JavaClass.ACTION_SEND); Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringToJString('Delphi Rocks!!!')); MainActivity.startActivity(Intent); finally end; end; But the text Delphi

Getting exception while opening PDF file for Android 26 using Firemonkey/Delphi

十年热恋 提交于 2019-12-24 04:29:27
问题 I'm using Delphi 10.1 Berlin for developing Android mobile application and I need to open the PDF file from the application but I'm getting the error - android.os.FileUriExposedException: file:///Storage/emulated/0/Download/AppDataDetails/1.Pdf exposed beyond app through Intent.getData() and below I have mentioned the code: AndroidManifest.template.xml: <!-- **** ADD THIS SECTION **** --> <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.AatchiyarIAS