Hi Greg,
I made a simple template as following:
1. one button and one text box.
2. JS codes are:
function XDocument::OnLoad(eventObj)
{
Application.ActiveWindow.Caption = "Hello World";
}
function CTRL1_5::OnClick(eventObj)
{
Application.ActiveWindow.Caption = "Hello World again by Clicking";
}
Every time the form is opened by either previewing or double clicking the template, the captical is "Preview1" or "Form1" correspondingly. After the button is clicked, it's changed to "Hello World by Clicking", and focus swiching between button and text box or inputting in the text box doesn't reflect the capital.
Then I added/modified the JS codes like:
var ii;
function XDocument::OnLoad(eventObj)
{
Application.ActiveWindow.Caption = "Hello World";
ii = 0;
}
function CTRL1_5::OnClick(eventObj)
{
Application.ActiveWindow.Caption = "Hello World again by Clicking";
}
function XDocument::OnContextChange(eventObj)
{
ii++;
Application.ActiveWindow.Caption = "Hello World " + ii;
}
Now every time when the form is displayed in "filling" mode, the capital is "Hello World 1". When the focus is changed, the count is added, and when the button is clicked after it just gets the focus, the capital will first be "Hello World by Clicking" then immediately changes to "Hello World *".
From the above, maybe I can say that event OnContextChange is triggered right after OnLoad. However, the default OnContextChange will set the capital to its initial form, namely "Preview*" for previewing and "Form*" for filling.
quote:
Originally posted by Greg Collins
Its probably no surprise for previewing, but you'll need to find out what is triggering the title change in your live form and then reset the title to your text when that trigger occurs.
I have seen this feature, but never used it--so I was unaware that InfoPath would change it back after setting it.