我在delphi的最后几天遇到了很多麻烦,我试图做的很简单,在某个点阻止接口并在其他一些点之后启用.
但就像听起来一样,我无法弄清楚为什么设计允许某些事情,所以要澄清:
1)创建一个项目
2)在表格中放置编辑和按钮,编辑的标签顺序必须先行
3)配置编辑的OnExit事件并写入:
Enabled := False;
Run Code Online (Sandbox Code Playgroud)
4)配置按钮的OnClick事件并写入:
ShowMessage('this is right?');
Run Code Online (Sandbox Code Playgroud)
基本上就是它,现在编译,它将在编辑时按下,按下选项卡,表格将按照我们的要求被禁用,因此相应于标签顺序,下一个获得焦点的控件是按钮(但我们禁用了表单),现在按空格键,消息应该出现.
所以问题是:这是对的吗?这个行为的逻辑解释是什么?
thx提前.
几天前我正在尝试从Devart开始使用名为EntityDAC的delphi的新ORM,我正在阅读特定于LINQ部分的文档,当我看到类似的内容时:
Linq.From(Emp).Where(Emp['Sal'] > 1000)
Run Code Online (Sandbox Code Playgroud)
我得说,在我看到的第一刻唤醒我.表达"Emp ['Sal']> 1000"不是lambda表达式?!因为试用版本是这个组件没有来源我无法弄清楚如何声明函数/过程.
参考:http://www.devart.com/entitydac/docs/ - > Linq查询 - > Linq语法 - >向下滚动到Where会话
好吧今天我在这里重新写了一些老东西,让自己陷入了一个我不知道答案的问题.
我创建了以下属性:
Enumeration<T> = class(TCustomAttribute)
strict private
{ Private declarations }
FValues : TList<T>;
public
{ Public declarations }
constructor Create(const AValues : array of T);
destructor Destroy(); override;
public
{ Public declarations }
property Values : TList<T> read FValues;
end;
Run Code Online (Sandbox Code Playgroud)
考虑到这一点,我可以在下面的类中使用此属性,例如:
[Entity('tablename')]
TUser = class(TEntity)
strict private
[Column('idcolumnname')]
[PrimaryKey(True)]
Fid : TInteger;
[Column('typecolumnname')]
[Enumeration<string>(['A', 'B', 'C', 'D', '...'])]
Ftype: TEnumeration<string>;
end;
Run Code Online (Sandbox Code Playgroud)
很棒,它工作但是idk,在我看来,这应该不起作用,在我的无知,delphi属性期望只有常量类型,我不仅使用数组作为一个参数,而是一个通用的.
移动foward,我做了这个属性:
Association = class(TCustomAttribute)
strict private
{ Private declarations }
FMasterKeys : TList<string>;
FDetailKeys : TList<string>;
public …
Run Code Online (Sandbox Code Playgroud) 我正在努力减少数量Uses
并遇到问题Enums
(* original unit, where types are defined etc *)
unit unit1;
type
TSomeEnumType = (setValue1, setValue2, ...);
...
Run Code Online (Sandbox Code Playgroud)
(* global unit where all types are linked *)
unit unit2;
uses unit1;
type
TSomeEnumType = unit1.TSomeEnumType;
...
Run Code Online (Sandbox Code Playgroud)
(* form unit that will use the global unit *)
unit unitform;
uses unit2;
...
procedure FormCreate(Sender : TObject);
var ATypeTest : TSomeEnumType;
begin
ATypeTest := setValue1; (* error says undeclared *)
ATypeTest := TSomeEnumType(0); (* Works but there's not …
Run Code Online (Sandbox Code Playgroud)