phantomwhale
December 7th, 2010, 06:44
Hello all,
This post was almost several different appeals for assistance, but I've got what I need working now. What I therefore wanted to check was have I done it well !
The issue I was facing came from moving a number of windowcontrols into a subwindow; a windowclass called "header" that is being included at the top of every character sheet pane. This removes copy and paste coding between the character sheet xml files.
These windowcontrols are templates which have bitmap widgets dynamically rendered inside them using a LUA script (Fate chips for the Deadlands extension, very similar to the Bennies field in the original Savage Worlds ruleset). This script does the typical thing in onInit() of register for the underlying databasenode's update method to ensure it modifies its appearance whenever the underlying value changes. It then calls the local update() method for good measure to ensure the control is correctly setup before any changes take place.
The difference came in, I think, due to this being shown on a subwindow. Suddenly this initial update was putting the widgets in the wrong place, and this was due to the getSize() method returning "0,0".
The fix ended up being implementing the onSubwindowInstantiated() method on the window class containing the fate chip template windowcontrols, and then simply calling update() on each windowcontrol. I also removed the update() call from the template's onInit() method, since it wasn't doing anything helpful.
My only concern here is the fatechip template windowcontrol is no longer "portable" - e.g. if I include it in another subwindow, I'll have to remember to add in this special setup call there too. Before, all the code was in the template's own LUA script, and therefore I could include this control anywhere within the character sheet without any further work.
Not a big issue, but I was wondering if I've made some false assumptions here (I did rewrite quite a lot of the anchoring / sizing XML code, and muck about with a lot of script code today, so it's quite quite possible !) ?
Any insight or ideas around this gratefully received !
Thanks,
Ben
This post was almost several different appeals for assistance, but I've got what I need working now. What I therefore wanted to check was have I done it well !
The issue I was facing came from moving a number of windowcontrols into a subwindow; a windowclass called "header" that is being included at the top of every character sheet pane. This removes copy and paste coding between the character sheet xml files.
These windowcontrols are templates which have bitmap widgets dynamically rendered inside them using a LUA script (Fate chips for the Deadlands extension, very similar to the Bennies field in the original Savage Worlds ruleset). This script does the typical thing in onInit() of register for the underlying databasenode's update method to ensure it modifies its appearance whenever the underlying value changes. It then calls the local update() method for good measure to ensure the control is correctly setup before any changes take place.
The difference came in, I think, due to this being shown on a subwindow. Suddenly this initial update was putting the widgets in the wrong place, and this was due to the getSize() method returning "0,0".
The fix ended up being implementing the onSubwindowInstantiated() method on the window class containing the fate chip template windowcontrols, and then simply calling update() on each windowcontrol. I also removed the update() call from the template's onInit() method, since it wasn't doing anything helpful.
My only concern here is the fatechip template windowcontrol is no longer "portable" - e.g. if I include it in another subwindow, I'll have to remember to add in this special setup call there too. Before, all the code was in the template's own LUA script, and therefore I could include this control anywhere within the character sheet without any further work.
Not a big issue, but I was wondering if I've made some false assumptions here (I did rewrite quite a lot of the anchoring / sizing XML code, and muck about with a lot of script code today, so it's quite quite possible !) ?
Any insight or ideas around this gratefully received !
Thanks,
Ben