我想在Delphi中为这个obj-c方法创建一个WebView的WebFrameLoadDelegate方法:
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
Run Code Online (Sandbox Code Playgroud)
如何在delphi中声明此方法?
这些不起作用:
public
procedure didFinishLoadForm( webView:WebView; Sender:WebFrame ); cdecl;
procedure webViewdidFinishLoadForm( webView:WebView; Sender:WebFrame ); cdecl;
Run Code Online (Sandbox Code Playgroud)
使用webview.setFrameLoadDelegate(d.GetObjectID)设置委托类似乎没问题;
其中d是TMyWebViewDelegate(TOCObject)类,GetObjectiveClass被覆盖,返回一个接口(NSObject),就像这里的工具栏委托http://delphihaven.wordpress.com/2012/07/15/using-the-cocoa-toolbar- nstoolbar合XE2 /
但我的方法没有被调用.声明这种obj-c方法的模式是什么?
假设我有一个类字段
a : array of array of double;
Run Code Online (Sandbox Code Playgroud)
它是使用嵌套的 SetLength 调用来分配的。
SetLength(a,100);
for i := 0 to length(a)-1 do SetLength( a[i], 100 );
Run Code Online (Sandbox Code Playgroud)
在对象销毁上是否有必要循环遍历数组的第一级以释放它的第二级项目?
for i := 0 to length(a)-1 do a[i] := NIL;
Run Code Online (Sandbox Code Playgroud)
是否有必要或者编译器也处理多维动态数组的释放?
(Firemonkey,XE7)我有一个带有TTextControl祖先的组件,引入了SizeConstraints,仅基于VCL版本.设计器不会将Constraint属性保存到.FMX文件中.当我查看"视图形式为文本"时,约束不存在,即使我之前编辑了属性值(是的,我可以在Object Inspector中编辑它,但它没有保存)这段代码有什么问题?
约束定义:
TSizeConstraints = class(TObject)
...
published
...
property MaxHeight: Single index 0 read FMaxHeight write SetConstraints;
property MaxWidth: Single index 1 read FMaxWidth write SetConstraints;
...
end;
Run Code Online (Sandbox Code Playgroud)
组件定义:
...
published
property Constraints : TSizeConstraints read FConstraints write SetConstraints;
...
procedure TMyComponent.SetConstraints(const Value: TSizeConstraints);
begin
FConstraints.Assign(Value);
end;
Run Code Online (Sandbox Code Playgroud)
并且TSizeConstraints.Assign会复制数据:
procedure TSizeConstraints.Assign( const C : TSizeConstraints );
begin
if Assigned( C ) then
begin
FMinHeight := C.FMinHeight;
FMaxHeight := C.FMaxHeight;
FMinWidth := C.FMinWidth;
FMaxWidth := C.FMaxWidth;
Change;
end;
end;
Run Code Online (Sandbox Code Playgroud)
我错过了什么,或者它是IDE错误?