对于没有用户界面访问权限的函数,使用未指定参数处理无效函数调用的最佳方法是什么
function safeSQRT ( x : Real) : real;
begin
/// check for valid params .....
if (x<0) then
begin
exit;
/// create a exception here ??
end;
end;
Run Code Online (Sandbox Code Playgroud) 有人已经找到使用DEPHI XE 5和Android OS编程闹钟的正确方法吗?
我找到了这个代码,但它根本不起作用/编译:
procedure TNotificationsForm.btnSendScheduledNotificationClick(Sender: TObject);
var
Notification: TNotification;
begin
{ verify if the service is actually supported }
if NotificationC.Supported then // compile error here
begin.Supported
Notification := NotificationC.CreateNotification; // compile error here
try
Notification.Name := 'MyNotification';
Notification.AlertBody := 'Delphi for Mobile is here!';
{ Fired in 10 second }
Notification.FireDate := Now + EncodeTime(0,0,10,0);
{ Send notification in Notification Center }
NotificationC.ScheduleNotification(Notification);
finally
Notification.DisposeOf;
end;
end
end;
Run Code Online (Sandbox Code Playgroud)
第一个错误是NotificationC.Supported此属性不存在
将所有选中的项目从 TChecklistBox 复制到 TStringlist 的最短代码是什么?
(对于 TListbox,我可以使用分配函数来添加和提取带有数据的 TStringlist)
我使用以下语句在MSSQL Server上启动查询
aquery.sql.text := ' select * from Mytable where <XXXXXXXXXXXXXXXXXXX>';
aquery.open;
repeat
//........
until aquery.EOF
Run Code Online (Sandbox Code Playgroud)
MyTable有4个额外的col#s:x1,x2,y1,y2; 我想从上面的SQL语句中获取前100行,但它们应该是具有最大区域的行,这意味着(area = abs(x1-x0)*abs(y1-y0);
获得最大区域的100条记录的最佳解决方案是什么,但是受限于给定的基本SQL语句?
Delphi 中读取文件内容并将内容作为字符串返回的最短代码解决方案是什么?
我糟糕的解决方案:
var
MyFile: TStringList;
Content: String;
.....
Myfile := TStringList.Create;
try
MyFile.Loadfromfile(InFilename);
Content := MyFile.Text;
finally
MyFile.free
end;
Run Code Online (Sandbox Code Playgroud)