delphi-xe5

Get SD card and executable path in Android and iOS with Delphi XE5 [closed]

末鹿安然 提交于 2019-12-01 07:17:00
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How do I get the SD card path and how do I get the executable path in Android and iOS using Delphi XE5? 回答1: Use System.IoUtils.TPath. The SD card path is obtained by using TPath.GetDocumentsPath , and the base directory of the app should be found with TPath.GetHomePath . uses IOUtils; var AppPath, CardPath:

Allowing keyboard input to a FireMonkey TEdit nested inside a FireMonkey TPopup

流过昼夜 提交于 2019-12-01 06:20:28
问题 I'm struggling to get a FireMonkey TEdit nested inside a FireMonkey TPopup to receive keyboard input. Happens both for desktop and mobile projects, though it's the latter I'm interested in: Create a new FMX project. Add a TButton and a TPopup to the form, and a TEdit to the TPopup . Set the popup's Placement property to plCenter and its PlacementTarget to Button1 . Handle the button's OnClick event by setting the popup's IsOpen property to True . Run the project, click/tap the button, and try

Why does scrolling through ADOTable get slower and slower?

别等时光非礼了梦想. 提交于 2019-12-01 03:41:38
I want to read the entire table from an MS Access file and I'm trying to do it as fast as possible. When testing a big sample I found that the loop counter increases faster when it's reading the top records comparing to last records of the table. Here's a sample code that demonstrates this: procedure TForm1.Button1Click(Sender: TObject); const MaxRecords = 40000; Step = 5000; var I, J: Integer; Table: TADOTable; T: Cardinal; Ts: TCardinalDynArray; begin Table := TADOTable.Create(nil); Table.ConnectionString := 'Provider=Microsoft.ACE.OLEDB.12.0;'+ 'Data Source=BigMDB.accdb;'+ 'Mode=Read|Share

Why does scrolling through ADOTable get slower and slower?

蹲街弑〆低调 提交于 2019-11-30 23:42:52
问题 I want to read the entire table from an MS Access file and I'm trying to do it as fast as possible. When testing a big sample I found that the loop counter increases faster when it's reading the top records comparing to last records of the table. Here's a sample code that demonstrates this: procedure TForm1.Button1Click(Sender: TObject); const MaxRecords = 40000; Step = 5000; var I, J: Integer; Table: TADOTable; T: Cardinal; Ts: TCardinalDynArray; begin Table := TADOTable.Create(nil); Table

Accessing Android's SharedPreferences class from Delphi

Deadly 提交于 2019-11-30 22:00:39
I have just started on the Android development path using Delphi XE5, and am trying to build a simple application that needs to be able to persist some entered information (configuration). I have figured out, that the Android class SharedPreferences probably is the easiest way to do this, but I can't figure out how to access this class from Delphi XE5 FMX Mobile. I have tried searching for "SharedPreferences" in the help, but it returns nothing. A search for "Shared Preferences", on the other hand, gives me too much. In a nutshell, add the required API units to the uses clause - the key ones

TRestClient/TRestRequest incorrectly decodes gzip response

假如想象 提交于 2019-11-30 20:25:08
I tried to read a REST API, which is gzip encoded. To be exact, I tried to read the StackExchange API. I already found the question Automatically Decode GZIP In TRESTResponse? , but that answer doesn't solve my issue for some reason. Test setup In XE5, I added a TRestClient, a TRestRequest and a TRestResponse with the following relevant properties. I set the BaseURL of the client, the resource and parameters of the request, and I set AcceptEncoding of the request to gzip, deflate , which should make it automatically decode gzipped responses. object RESTClient1: TRESTClient BaseURL = 'https:/

Accessing Android's SharedPreferences class from Delphi

我们两清 提交于 2019-11-30 18:04:02
问题 I have just started on the Android development path using Delphi XE5, and am trying to build a simple application that needs to be able to persist some entered information (configuration). I have figured out, that the Android class SharedPreferences probably is the easiest way to do this, but I can't figure out how to access this class from Delphi XE5 FMX Mobile. I have tried searching for "SharedPreferences" in the help, but it returns nothing. A search for "Shared Preferences", on the other

how to fix TTreeView bug when using TreeNode.MoveTo?

China☆狼群 提交于 2019-11-30 17:39:04
问题 Using TreeNode.MoveTo(...) method sometimes does not work properly and raises an "Access Violation" exception. mosttimes works and some time not. Mosttimes 'Access Violation in module COMCTL32.DLL. Read of address FEEEFEFA' and program crash/freeze. here is my code. procedure TForm1.FormShow(Sender: TObject); var I, sectioncount: Integer; parent, child: TTreeNode; begin sectioncount := 0; for I := 0 to 19 do begin if I mod 5 = 0 then begin parent := TreeView1.Items.AddChild(nil, 'Section: ' +

How to convert strings to array of byte and back

ぃ、小莉子 提交于 2019-11-30 12:17:50
4I must write strings to a binary MIDI file. The standard requires one to know the length of the string in bytes. As I want to write for mobile as well I cannot use AnsiString, which was a good way to ensure that the string was a one-byte string. That simplified things. I tested the following code: TByte = array of Byte; function TForm3.convertSB (arg: string): TByte; var i: Int32; begin Label1.Text := (SizeOf (Char)); for i := Low (arg) to High (arg) do begin label1.Text := label1.Text + ' ' + IntToStr (Ord (arg [i])); end; end; // convert SB // convertSB ('MThd'); It returns 2 77 84 104 100

Firemonkey: Adding a font from resource to memory and using it

我与影子孤独终老i 提交于 2019-11-30 09:10:31
In VCL , I could load a font from resource and without saving it I could use it from memory. Here is the code I use and it works in VCL : procedure TForm1.Button1Click(Sender: TObject); var ResStream : tResourceStream; FontsCount : DWORD; begin ResStream := tResourceStream.Create(hInstance, 'MyResourceName', RT_RCDATA); winapi.windows.AddFontMemResourceEx(ResStream.Memory, ResStream.Size, nil, @FontsCount); ResStream.Free(); button1.Font.name := 'MySavedFontNameInResource'; end; In Firemonkey I just changed button1.Font.name to button1.Font.family but unfortunately the font didn't change. So I