delphi-xe7

Delphi XE7: How to get native statusbar behavior in iOS 7?

风流意气都作罢 提交于 2019-12-06 15:59:34
In iOS 7 the default behavior of the statusbar is to be transparent, but that seems impossible in Delphi XE7. The statusbar always get the same color as the mainform (which was the default behavior in iOS 6). The Mainform.borderstyle controls if the statusbar is shown or not, but I cannot find any way to set it transparent. I have tried setting UIViewControllerBasedStatusBarAppearance and UIStatusBarStyle in the info.plist and tried to call TUIApplication.wrap(TUIApplication.OCClass.sharedApplication).setStatusBarStyle(UIStatusBarStyleBlackTranslucent) but it remains solid. Did anyone succeed

How to send email with attachment using default Android email app - Delphi XE7

∥☆過路亽.° 提交于 2019-12-06 13:18:45
Using code below which I found on another post , the email appears ready to send with the attachment, but when email is received, there is no attachment. Also, the email address has to be manually entered, it is not populated by the CreateEmail statement. I am sending from a gmail account. Anyone help please? procedure TForm1.CreateEmail(const Recipient, Subject, Content, Attachment: string); var Intent: JIntent; Uri: Jnet_Uri; AttachmentFile: JFile; begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_SEND); Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);

How to create a default project under Delphi XE7?

*爱你&永不变心* 提交于 2019-12-06 05:50:46
Related to this question: Should "Library path" point to the source files of packages? Fabricio Araujo suggested that is not necessary to set the 'search path' for each new project by creating a 'Default Project Option'. How can this be done in Delphi XE7? How this can be done in Delphi XE7? It cannot. This functionality was removed I'm not sure exactly when, but it has not been present for some considerable time. What you can do is: Create a new project. Change its settings however you please. Save this modified project template to some central location. Whenever you make a new project, do so

Using C++ Classes in Delphi

帅比萌擦擦* 提交于 2019-12-06 05:41:18
How can I use a C++ class in Delphi? I am trying to use it through an abstract class. However it doesn't work as expected I get weird numbers from Age(); . Delphi: program Test; {$APPTYPE CONSOLE} type IPerson = class function Age(): Integer; overload; virtual; stdcall; abstract; procedure Age(const Value: Integer); overload; virtual; stdcall; abstract; end; const DLL = 'Interface.DLL'; procedure FreePerson(const Person: IPerson); external DLL; function CreatePerson(): IPerson; external DLL; var Person: IPerson; I: Integer; begin Person := CreatePerson; Person.Age(10); I := Person.Age(); // I

How to use generics as a replacement for a bunch of overloaded methods working with different types?

不想你离开。 提交于 2019-12-06 02:27:01
I have a bunch of overloaded methods, all of them get an array of some type as a parameter and return a random value from that array: function GetRandomValueFromArray(Arr: array of String): String; overload; begin Result := Arr[Low(Arr) + Random(High(Arr) + 1)]; end; function GetRandomValueFromArray(Arr: array of Integer): Integer; overload; begin Result := Arr[Low(Arr) + Random(High(Arr) + 1)]; end; etc. How can I use generics to create a single method for array of any type? Something like this (does not compile in Delphi XE7): function GetRandomValueFromArray(Arr: TArray<T>): <T>; Appreciate

How to pause a thread?

时光怂恿深爱的人放手 提交于 2019-12-05 20:25:28
I want to draw something. Because the GUI freezes I want to draw in a thread. But sometimes I want to pause the drawing (for minutes). Delphi's documentation says that Suspend/resume are obsolete but doesn't tell which functions replaces them. Suspend and Resume are deprecated. Sleep and SpinWait are obviously inappropriate. I am amazed to see that Delphi does not offer such a basic property/feature. So, how do I pause/resume a thread? You may need fPaused/fEvent protection via a critical section. It depends on your concrete implementation. interface uses Classes, SyncObjs; type TMyThread =

TDirectory.Delete seems to be asynchronous

半世苍凉 提交于 2019-12-05 19:17:47
I have observed that calling DirectoryExists(x) immediately after calling TDirectory.Delete(x) returns true IF the folder to be deleted has few files in it AND the folder is open (in Total Commander). In other words: begin TDirectory.Delete('x', true); <-- 'Delete' exited but the folder is still not fully deleted if SysUtils.DirectoryExists('x')... <-- This returns true end; Is this a normal behavior? The "solution" is this: begin TDirectory.Delete('x', true); Sleep(1000); //wait for Delete to finish if SysUtils.DirectoryExists('x')... end; Question: How do I know when the Delete is ready (how

Best way to implement MVVM bindings (View <-> ViewModel) in Delphi? [closed]

a 夏天 提交于 2019-12-05 04:03:15
For a multi-platform application using native components, the standard Delphi approach is no longer sufficient. So far our structure had only to parts: GUI (Forms) and Business logic. We now need to split the "Forms" part into two, which in a MVVM context would be View and ViewModel . The bindings between View and ViewModel can be handled in different ways: LiveBindings in Delphi DSharp (Delphi Sorcery) Delphi Spring (Spring4D) There might be more. I know this is a religious question to some, but I still hope it is possible to get objective answers: If you are using a solution in your

How to improve multiple StringReplace calls?

萝らか妹 提交于 2019-12-05 02:47:04
问题 I read files from customers and I need to process the read data and remove some unneeded characters. My function works, but I'm trying to improve the FixData function to improve speed/performance and maintainability. Is it possible to replace multiple StringReplace calls with something that will only loop through data once and replace with whatever it needs to? I can't find MultipleStringReplace or similar function. MCVE: function FixData(const vStr:string):string; var i:integer; begin Result

Which is the best way to load a string (HTML code) in TWebBrowser?

北战南征 提交于 2019-12-04 17:49:26
I have a string var 'HTMLCode' that contains HTML code. I want to load this code into the browser. This is Embarcadero's code: procedure THTMLEdit.EditText(CONST HTMLCode: string); {VAR Doc: IHTMLDocument2; TempFile: string; } begin TempFile := GetTempFile('.html'); StringToFile(TempFile, HTMLCode); wbBrowser.Navigate(TempFile); Doc := GetDocument; if Doc <> NIL then Doc.Body.SetAttribute('contentEditable', 'true', 0); //crash here when I load complex html files DeleteFile(TempFile); end; It has some problems so I replaced it with this one: procedure THTMLEdit.EditText(CONST HTMLCode: string);