PDA

View Full Version : onInit and tabs refresh



Ardem
January 13th, 2017, 00:04
Now Oninit() works great the first time when you have a refresh() script to kick off in a tabbed window such as a character sheet, however when you change focus away and come back again to the same tab it does not launch again, unless you close the character sheet down.(as expected because only launches on on initializing)

My question is -- Is there a function that launches on focus, so each time you go into the tab field it launches, however does not launch the first time.

Basically I have a refresh script, that gather data from the other tabs and put in modification numbers, however I launch this refresh script at the end of the page build (oninit on the last windows object) and if there is any changes in the drop down menus. But I notice if they go to other tabs and modify data it only modifies when they get back it has not updated the calculations on the tab.

Moon Wizard
January 13th, 2017, 00:22
The onInit event for a windowinstance will only fire when the window is first initialized. Since the windows for tabs other than the first are not created until you change to that tab, that's why the onInit event only triggers when you first select the tab.

If you add a "function onTabVisChanged(bShow)" to a control within a tabbed windowinstance, then the tabs template script will call that function when the tabbed window is selected or deselected. This may be enough for what you are trying to do. There are some examples in the 3.5E and 4E rulesets.

Regards,
JPG

Ardem
January 13th, 2017, 22:40
once again thanks Moon