I'm looking for some code allowing easy asigning many event handlers to a single event of object... I needed it very much for my plugin architecture, so I implemented some replacement for that, however I don't like my solution for that, so I'd like to know what is yours idea/solution/tip ... My solution is just a list with items like
eventName: string;
proc: TMyEventProc;
where TMyEventProc takes two arguments, sender and eventData: pointer.
depending on name of the event, eventData …
我能走远路,遍历每一行,获得了TRect从CellRect(col, row),然后查询其State为gdSelected...
但是,有没有更快的方法来获取当前所选行的行号,如果有的话?
Delphi 2010,Win32 VCL.我需要以最标准的外观为我的应用程序创建一个主菜单.TMainMenu在所有Windows版本中看起来都不错,唯一不好的是当它显示具有Enabled = False的项目的图像时.
Delphi有一些奇怪的方法来构建禁用的图像(使用斜面进行b/w挤出,对我来说它看起来像是喷出).我想在VCL源代码中为该过程制作一个补丁,让菜单从同一个TImageList中选择禁用的图像,但我找不到它.
它是否存在或者是一些标准的Windows API调用?你知道那个程序在哪里吗?
当然OwnerDraw风格可以修复所有这些,但我想要更快的解决方案.
我有在服务和VCL表单应用程序(win32应用程序)中使用的代码.如何确定底层应用程序是作为NT服务还是作为应用程序运行?
谢谢.
我们有一些遗留代码可以在Delphi 6中编译.有计划在更新的IDE中重写它,但它们是一种出路.
当我们编译它时,我们得到几个这样的警告:
FPrecision is specific to a platform.
这是在VCL\DB.pas中.(不是我们的文件.)FPrecision定义如下:
FPrecision Integer Platform
我可以看出为什么它是特定于平台的,但我真的不知道如何处理它.
这只是在我们迁移到Windows 7进行开发时才开始发生的.
我看到了这个问题,但解决方案对我不起作用.我无法将预编译器标签添加到DB.pas并且项目文件没有任何选项(我可以看到)来抑制此警告.
我是唯一可以关闭所有警告或与之共存的选项吗?
我已经创建了一个基于TPaintBox的组件TGridPaintBox.它基本上是一个添加了"网格功能"的绘图箱.它不是数据网格.更像是棋盘组件.
在对象资源管理器中,我可以设置某些属性.最重要的是,我可以设置网格尺寸(横跨/向下有多少个单元格),还可以设置与绘图相关的选项.细胞是否应该是正方形,奇数/偶数细胞的颜色等.
我的第一个版本的组件直接在类上有属性,当我更改属性时,立即更新了设计时图.随着组件的增长,我想更好地组织我的属性,并引入了一些"选项属性",如绘图选项,行为选项等.在介绍之后,设计时绘图不再像以前那样更新.更改属性后,我必须单击组件才能更新.谁能告诉我为什么会这样?
这是代码的精简版本.我希望它能解释这种行为:
(PS:这是我的第一个组件,即使我自1997年以来一直使用Delphi,所以如果有人能像我做的那样发现任何愚蠢的东西,请随时告诉我)
unit GridPaintBox;
interface
type
TGridDrawOption = (gdoSquareCells,gdoCenterCells,gdoDrawCellEdges,gdoDrawFocus);
TGridDrawOptions = set of TGridDrawOption;
TGridOptions = class(TPersistent)
private
FCellsX : integer;
FCellsY : integer;
FDrawOptions : TGridDrawOptions;
public
constructor Create(aGridPaintBox : TGridPaintBox);
procedure Assign(Source : TPersistent); override;
published
property CellsX : integer read FCellsX write FCellsX;
property CellsY : integer read FCellsY write FCellsY;
property DrawOptions : TGridDrawOptions read FDrawOptions write FDrawOptions;
end;
TGridPaintBox = class(TPaintBox)
private
FGridOptions : TGridOptions;
FFocusedX,
FFocusedY : integer;
FOnFocusChanged: TNotifyEvent;
procedure …Run Code Online (Sandbox Code Playgroud) 我无法让ExitCode适用于VCL表单应用程序.这是我的测试应用程序.它是从Delphi 2007 IDE的File/New菜单创建的.唯一的变化是我ExitCode := 42;在最后添加了这一行.
program Test;
uses
Forms,
Unit27 in 'Unit27.pas' {Form27};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm27, Form27);
Application.Run;
ExitCode := 42;
end.
Run Code Online (Sandbox Code Playgroud)
现在,当我从命令行运行它时,%ERRORLEVEL%没有设置:
>.\Test.exe
>echo %ERRORLEVEL%
0
Run Code Online (Sandbox Code Playgroud)
我被期望值%ERRORLEVEL%为42,但它没有被更新.
我在控制台应用程序中尝试了相同的实验,并且工作正常.为什么它不能用于我的GUI应用程序?
我无法弄清楚,对于我的生活,如何让varnish忽略500内部服务器错误的缓存.基本上,如果某人遇到清漆并返回500内部服务器错误,我希望varnish不缓存该页面(设置0s ttl /宽限期?).我正在使用清漆3.0.3,这是我的VCL.默认情况下,我想将页面缓存30天.
sub vcl_fetch {
# Set 30-day TTL
set beresp.ttl = 2592000 s;
set beresp.grace = 15d; /* The max amount of time to keep object in cache */
if (beresp.status == 301 || beresp.status == 302) {
return (hit_for_pass);
}
# Serve pages from the cache should we get a sudden error and re-check in one minute
if (beresp.status >= 500) {
set beresp.grace = 1s;
set beresp.ttl = 1s;
return (hit_for_pass);
}
# Unset the "etag" …Run Code Online (Sandbox Code Playgroud) 我需要找到DecimalSeparator var SysUtils Delphi 7,在Delphi XE6中我试图在System.SysUtils中找到,但没有成功.有人可以告诉我在Delphi XE6中哪里可以找到她吗?
在Delphi 7中,它位于第618行的SysUtils.pas单元中:
var
CurrencyString: string;
CurrencyFormat: Byte;
NegCurrFormat: Byte;
ThousandSeparator: Char;
DecimalSeparator: Char;
Run Code Online (Sandbox Code Playgroud)
我需要这个变量来将Delphi 7的一个组件转换为XE6
VCL似乎提供了两种隐藏表单设计者控件的机制:TControlState.csDesignerHide和TControlStyle.csNoDesignVisible.
就IDE而言,它们之间有什么区别?你应该在什么时候使用?
vcl ×10
delphi ×9
components ×2
c++builder ×1
delphi-2010 ×1
delphi-6 ×1
events ×1
exit-code ×1
menu ×1
menuitem ×1
return-code ×1
tstringgrid ×1
varnish ×1
windows-7 ×1