In a FireMonkey app on Windows, I have a DLL with various dialog boxes, some of which have TEdit controls.
When I launch these dialogs from the main application, the TEdit boxes do not display the caret. Tracing the problem, I see that the TEdits never receive focus, even when I set the focus programmatically. Also, if I create the dialogs in the main app without the DLL, the caret shows as it should.
Is there any way to solve this problem with the DLL and get the Edit boxes to show their caret properly? The following shows an example of my code.
example dialog:
unit dlldlg;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.Edit;
type
TDllForm = class(TForm)
Edit1: TEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
DllForm: TDllForm;
implementation
{$R *.fmx}
end.
library:
library BTDialog;
uses
System.SysUtils,
System.Classes,
System.UITypes,
FMX.Forms,
{[...]}
dlldlg in 'dlldlg.pas' {DllForm};
{$R *.res}
var Main:TForm;
Function DLLFormDlg:boolean; stdcall;
var
DllForm: TDllForm;
begin
DllForm := TDllForm.Create(Application);
result := false;
try
if DllForm.ShowModal = mrOK then
result := true;
finally
FreeAndNil(DllForm);
end;
end;
exports
{[...]}
{,} DLLFormDlg
;
begin
end.
MainForm:
interface
const DlgDLL = 'BTDialog.dll';
Function DLLFormDlg:boolean; stdcall;external DlgDLL;
implementation
{$R *.fmx}
procedure TBTMain.Button1Click(Sender: TObject);
begin
DLLFormDlg;
{ shows dialog box, but the TEdit component does not show its caret }
end;