我创建了一个更新 SQLite 数据库的过程。该过程循环运行,直到列表完成。问题是,当我运行该程序时,程序停止响应
如何在后台运行此程序而不使程序崩溃?
procedure TForm1.domainupdate;
var
I, J, K, svr: integer ;
domain1, domain2: string ;
expiry: string;
sl: TStringList;
fs: TFormatSettings;
s: string;
dt: TDatetime;
ds : TFormatSettings;
memo : tmemo;
begin
DM.Qdomains.First;
while not DM.Qdomains.Eof do begin
for J := Length (DM.Qdomains.FieldByName('domain').AsString) downto 2 do begin
if DM.Qdomains.FieldByName('domain').AsString [J] = '.' then begin // search host.co.uk
if domain1 = '' then
domain1 := Copy (DM.Qdomains.FieldByName('domain').AsString, J + 1, 99) + IcsSpace
// found uk
else begin
domain2 …
Run Code Online (Sandbox Code Playgroud) 我在 Delphi Firemonkey 中对 FMX.Calendar.Style 进行子类化,以便向 TCalendar 组件添加更多功能。我想添加“拖动选择”多天(一天范围)。我有一个粗略的工作原理证明。我在另一个单元的 FMX.Calendar.Style 中对 TStyledCalendar 进行子类化。
为了提取选定的日期,我需要转换为 TDayItem。问题是类型 TDayItem 在实现部分中定义,因此无法在新类的其他单元中访问。
有办法访问它吗?
unit FMX.Calendar.Style;
interface
{$SCOPEDENUMS ON}
uses
System.Classes, .., ..
type
{ TStyledCalendar }
TStyledCalendar = class(TStyledPresentation)
public const
CountOfVisibleDays = 6 * 7;
..
..
..
end;
implementation
uses
System.SysUtils, .. ..
type
TDayItem = class(TListBoxItem)
private
FDate: TDateTime;
public
property Date: TDateTime read FDate write FDate;
end;
..
..
Run Code Online (Sandbox Code Playgroud) 我有一个Firemonkey HD应用程序并将其部署在iPad 2上.工作正常.
当我在带有Retina显示屏的iPad 4上部署相同的应用程序时,我遇到了问题.
关键是我在表单上有一些绘图操作,需要精确的表格宽度和高度.
ShowMessage('form wh = ' + FloatToStr(TForm(FImage.Parent.Parent). Width) + ':' + FloatToStr(TForm(FImage.Parent.Parent).Height));
Run Code Online (Sandbox Code Playgroud)
在两台设备上我收到一条消息:
form wh = 1024:748
Run Code Online (Sandbox Code Playgroud)
我需要的是自动更改表单大小.
我该怎么做才能得到它?
更新:我尝试使用Screen.Size.Width但在Retina显示屏上有Screen.Size.Width = 1024.我做错了什么?
我是Delphi和Firemonkey的新手.
让我说我动态地(在运行时)在我的表单上创建一个新按钮,我想抓住它的OnCLick事件.
如何将我的控制绑定到onclick程序?
谢谢
我正在delphi xe6上开发一个GCM Push通知.我使用此帖子中的代码/sf/ask/1502626611/(使用AndroidManifest.xml中的标准组件)为我自己的应用程序和即使应用程序未运行,我也设法使用该服务接收通知.
但是当我收到通知时我遇到了问题,那就是我无法捕获onclick事件,因此我的应用程序打开(很棒),但它不会执行欲望操作.
这是我的AndroidManifest.xml
<receiver android:name="com.embarcadero.gcm.notifications.GCMNotification" android:exported="true">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="%package%" />
</intent-filter>
</receiver>
<service android:name="com.embarcadero.gcm.notifications.GCMIntentService">
</service>
Run Code Online (Sandbox Code Playgroud)
如果我使用帖子中的代码,我可以检测用户何时点击通知,但我不知道如何使用标准组件.
问候
delphi notifications firemonkey google-cloud-messaging delphi-xe6
假设我有五个TRectangle对象,并且一个函数将传入一个参数以使其中一个闪烁.
我知道如何控制一个对象,如下面的代码:
procedure TForm1.TimerTimer(Sender: TObject);
begin
if rect1.Visible then
rect1.Visible := false
else
rect1.Visible := true;
end;
procedure TForm1.Blink_Square;
begin
Timer := TTimer.Create(nil);
Timer.OnTimer := TimerTimer;
rect1.Fill.Color := TAlphacolors.Red;
rect1.fill.Kind := TBrushKind.bkSolid;
rect1.Stroke.Thickness := 1;
rect1.Stroke.Color := Talphacolors.Darkgray;
Timer.Interval := 500;
Timer.Enabled := True;
end;
Run Code Online (Sandbox Code Playgroud)
但我真的不知道,如果有一种方法,我可以重复使用眨眼广场就像有一个步骤,procedure TForm1.Blink_Square(rec_number: integer);
我们可以调用Blink_Square(5);
做rect5
眨眼.
提前致谢
随着XE7中非阻塞MessageDlg的出现,似乎现在无法有条件地阻止该应用程序.从我们在Windows中关闭(或在XE5中):
procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := False;
FCanClose := False;
FMX.Dialogs.MessageDlg('Exit?'
,
TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0,
procedure(const AResult: TModalResult)
begin
if AResult = mrYes then
FCanClose := True;
end
);
CanClose := FCanClose;
end;
Run Code Online (Sandbox Code Playgroud)
仅在表单已关闭后才调用MessageDlg(和匿名过程),从而使对象失效.哦,如果你想知道我为什么使用FCanclose,那是因为我在匿名程序中遇到了"无法捕获Canclose"的编译器错误.
现在我尝试的另一种可能性是将MessageDlg放在FormKeyUp事件处理程序中并捕获vkHardwareBack.
procedure TfrmMain.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
var
FService: IFMXVirtualKeyboardService;
begin
if Key = vkHardwareBack then
begin
TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyBoardService,
IInterface(FService));
if (FService <> nil) then
begin
if (TVirtualKeyBoardState.Visible in FService.VirtualKeyBoardState) then
else
begin
FMX.Dialogs.MessageDlg('Exit?'
, …
Run Code Online (Sandbox Code Playgroud) 在Windows中,我习惯于QueryPerformanceCounter
以微秒为单位测量代码性能.我想在Firemonkey中的所有平台上做同样的事情.我找到了一个解决方案,但它只适用于C++.
所有平台的等价物是什么?
在我的表格中,有30个或更多TCheckbox与TNumberBox在他们面前.每个TCheckbox和TNumberBox都连接,如CheckBox1名称为C1,NumberBox为C1E,Checkbox2为C2,NumberBox2为C2E,依此类推.如果C1已选中,则C1E将被启用.我不想为每个Tcheckbox使用不同的onclick事件.我只想对所有TCheckbox onclick事件使用单个过程.我怎样才能做到这一点 ?
当我尝试将FireDAC FDQuery与MySQL数据库一起使用时,出现以下错误:
Cannot perform this operation on an open dataset.
Run Code Online (Sandbox Code Playgroud)
query.Open(....my connection string to MySQL....);
try
query.ExecSql;
finally
query.Close;
Run Code Online (Sandbox Code Playgroud)
我通过双击表单上的图标来填充FDQuery。我还连接到数据库进行测试。它正确地返回了结果。我想从代码中使用它,但是它不起作用,因此我对其进行了调试。我总是到断点:query.Close;
delphi ×10
firemonkey ×10
android ×1
calendar ×1
delphi-xe5 ×1
delphi-xe6 ×1
delphi-xe7 ×1
delphi-xe8 ×1
firedac ×1
ios ×1
mysql ×1
performance ×1