SkylineGlobe7.0.1版本 主页面如何和Popup里面的嵌入页面相互传值

时间:2021-07-10 09:06:08

不想多说废话,直接看代码吧!(支持IE和Chrome)

主页面:

function ShowPanel() {
var sg = CreateSGObj();
var pp = sg.Creator.CreatePopupMessage("功能页", "http://localhost:4319/Coding/sgw701/Window/MousePosLabel.htm", 305, 0, 30, 50, -1); sg.Window.ShowPopup(pp); SetTempValue("asdfghijk");
} function SetTempValue(value)
{
var sg = CreateSGObj();
var labelPos = sg.Creator.CreatePosition(0, 0, 0, 2);
var label1 = sg.Creator.CreateTextLabel(labelPos, value, sg.Creator.CreateLabelStyle());
label1.TreeItem.Name = value;
label1.Tooltip.Text = value;
alert(label1.Tooltip.Text);
}

子页面:

function Init()
{
try
{
var SGWorld = new CreateSGObj();
var npid = SGWorld.ProjectTree.FindItem("asdfghijk");
alert(SGWorld.ProjectTree.IsGroup(npid));
var obj = SGWorld.ProjectTree.GetObject(npid);
alert(obj.Tooltip.Text);
}
catch (e)
{
alert(e);
}
}