initialize Window.DialogCount and improve TitleElement selecting

This commit is contained in:
Michael Becker 2024-11-01 22:56:36 -04:00
parent 70e1c08915
commit 4907bcba10

View File

@ -7,6 +7,7 @@ function Window(parentElement)
if (!parentElement) if (!parentElement)
{ {
parentElement = document.createElement("div"); parentElement = document.createElement("div");
parentElement.NativeObject = this;
parentElement.className = "uwt-window"; parentElement.className = "uwt-window";
var titleBar = document.createElement("div"); var titleBar = document.createElement("div");
@ -31,6 +32,7 @@ function Window(parentElement)
document.body.appendChild(parentElement); document.body.appendChild(parentElement);
} }
this.ParentElement = parentElement; this.ParentElement = parentElement;
this.TitleElement = this.ParentElement.children[0].children[0];
this.mvarContentURL = null; this.mvarContentURL = null;
/** /**
@ -179,7 +181,7 @@ function Window(parentElement)
*/ */
this.GetTitle = function() this.GetTitle = function()
{ {
return this.ParentElement.childNodes[0].childNodes[0].innerHTML; return this.TitleElement.innerHTML;
}; };
/** /**
* Sets the title of this Window. * Sets the title of this Window.
@ -187,7 +189,7 @@ function Window(parentElement)
*/ */
this.SetTitle = function(title) this.SetTitle = function(title)
{ {
this.ParentElement.childNodes[0].childNodes[0].innerHTML = title; this.TitleElement.innerHTML = title;
}; };
/** /**
@ -303,6 +305,11 @@ function Window(parentElement)
}; };
this.ShowDialog = function() this.ShowDialog = function()
{ {
if (typeof(Window.DialogCount) == 'undefined')
{
Window.DialogCount = 0;
}
Window.DialogCount++; Window.DialogCount++;
if (Window.ModalBackgroundElement == null) if (Window.ModalBackgroundElement == null)