我在使用样式时点击TDateEdit选择器中的选定日期时会出现访问冲突。
首先,您必须从(DELPHI)/ Redist / styles / fmx文件夹中的样式样本中选择任何样式到TStyleBook组件。
然后运行程序并从Windows上的datepicker中选择任何日期
单位:" untDateTime.pas"
unit untDateTime;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.DateTimeCtrls, FMX.Styles.Objects, FMX.Ani, FMX.StdCtrls, FMX.Effects,
FMX.Filter.Effects;
type
TForm1 = class(TForm)
StyleBook1: TStyleBook;
DateEdit2: TDateEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
end.
来自设计和错误的图片:
答案 0 :(得分:0)
现在在东京NeedStyleLookup实际上是免费控制风格的资源。当你点击弹出窗口中的日期时,TCalendar会弹出IsOpen:= False弹出窗口并弹出窗体杀死TCalendar的样式资源 - FPopupForm.RemoveObject(Self);
我没有看到通过制作自定义TDateEdit来解决这个问题的优雅方法。 只能提供一种快速解决方案。我不知道ISO和ANDROID在其他单位的情况(FMX.PhoneDialer.iOS.pas,FMX.PhoneDialer.iOS.pas)。对于其他人,您可以在项目中复制FMX.Pickers.Default.pas并将其重命名为例如FMX.Pickers.DefaultFix.pas
现在添加此更改:
procedure TPopupDateTimePicker.DoDateSelected(Sender: TObject);
begin
TThread.CreateAnonymousThread(
procedure
begin
TThread.Synchronize(nil,
procedure
begin
IsOpen := False;
end);
end).Start;
// IsOpen := False;
end;
procedure TPopupDateTimePicker.DoDayClick(Sender: TObject);
begin
DoDateChanged(Parent);
TThread.CreateAnonymousThread(
procedure
begin
TThread.Synchronize(nil,
procedure
begin
IsOpen := False;
end);
end).Start;
// IsOpen := False;
end;
并添加
initialization
{$IFNDEF IOS OR ANDROID}
UnregisterPickersService;
RegisterPickersService;
{$ENDIF}
end.
答案 1 :(得分:0)
这对我有用:
procedure TMAIN.AppException(Sender: TObject; E: Exception);
begin
//--- DO NOTHING ---
//Application.ShowException(E);
//Application.Terminate;
end;
procedure TMAIN.DateEdit2Change(Sender: TObject);
begin
Application.OnException := AppException;
end;