我有一个带有iFrame 的TEmbeddedWB(https://sourceforge.net/projects/embeddedwb/).我必须找出特定的HTML标签是否在iFrame内部.我的iFrame对象是a IHTMLFrameBase2,而Tag是a IHTMLElement.我知道iFrame.contentWindow.document(这是一个IHTMLDocument2)是一样的Tag.document.但是它Tag.document是一个IDispatch对象,因此下面给出了一个错误:
if iFrame.contentWindow.document = Tag.document then ShowMessage('In iFrame')
else ShowMessage('Not in iFrame');
Run Code Online (Sandbox Code Playgroud)
我知道这两个对象是一样的,因为Watch List可以显示它们的内存地址:
但我无法从代码中获取他们的地址.我尝试过的:
Addr(iFrame.contentWindow.document) // Gives variable required error
@iFrame.contentWindow.document // Gives variable required error
Pointer(iFrame.contentWindow.document) //Compiles, but gives wrong address
Format('%p',[iFrame.contentWindow.document]) //Compiles, but gives EConvertError
Run Code Online (Sandbox Code Playgroud)
注意:如果我逐行运行监视列表显示的地址在每行代码后都会发生变化,无论代码是否影响WebBrowser.
我使用API v3在Google地图上动态创建了很多多边形.我没有它们的全局数组.我在创建后为每个事件分配事件,因为我需要跟踪用户对它们所做的更改.一切都很好,除了一件事.
path = polygon.getPath(); //Note, that polygon isn't a global variable
//DragEnd
google.maps.event.addListener(polygon, "dragend", function(){
SavePolygonToDb(this);
});
//Edited
google.maps.event.addListener(path, "set_at", function() {
//Now 'this' is the path array, not the polygon
SavePolygonToDb(????);
});
Run Code Online (Sandbox Code Playgroud)
不知怎的,我需要得到路径所属的多边形对象,但我无法找到它的方法.我想出的唯一解决方案是,我需要将所有多边形及其路径存储在一个数组中,然后如果发生变化,我会遍历数组并将路径值与实际值进行比较.如果某些LatLng坐标不同,则多边形会发生变化.将新值保存到后端阵列,然后继续.但我认为,必须有一些其他(更容易)的解决方案来做到这一点.