phantomwhale
August 7th, 2011, 05:10
I've been going down a route for the last week on the SWEX combat tracker that may have just hit a clanger of a problem.
The setup is I have a windowlist of "combatantgroups". This class is a windowclass that contains (1) a subwindow, with a class of "combatant" and (2) a windowlist of class "combatant".
The logic behind this changes is each main windowlist entry WILL contain a combatant (this is the subwindow) and MIGHT contain another list of combatants (any "grouped" combatants who act at the same time as the main one). And by using a subwindow, I can re-use the same inner window class in for both main and grouped combatants.
The problem comes with subwindow initialising. I've just found that the subwindows don't get initialised until they are on the screen. Meaning if I add new combatantgroups that appear after the end of the window, they don't get "initialised", and therefore don't get cards dealt to them or anything.
The same problem appears on the mini-tracker - it will show five combatants, but just the first five (properly ordered). When I scroll down to look at other combatants, the subwindow initialises and the combatant suddenly jumps into place on the list (as the applySort() method gets triggered).
The workaround is the GM needs to scroll to the bottom of the combatant lists ONCE, but the players need to scroll to the bottom of the minitracker every round. This... isn't going to work !
What I was wondering is if there is some way of getting all the subwindows to initialise programatically ? Might involve some trickery, as I don't see an API call for it...
The setup is I have a windowlist of "combatantgroups". This class is a windowclass that contains (1) a subwindow, with a class of "combatant" and (2) a windowlist of class "combatant".
The logic behind this changes is each main windowlist entry WILL contain a combatant (this is the subwindow) and MIGHT contain another list of combatants (any "grouped" combatants who act at the same time as the main one). And by using a subwindow, I can re-use the same inner window class in for both main and grouped combatants.
The problem comes with subwindow initialising. I've just found that the subwindows don't get initialised until they are on the screen. Meaning if I add new combatantgroups that appear after the end of the window, they don't get "initialised", and therefore don't get cards dealt to them or anything.
The same problem appears on the mini-tracker - it will show five combatants, but just the first five (properly ordered). When I scroll down to look at other combatants, the subwindow initialises and the combatant suddenly jumps into place on the list (as the applySort() method gets triggered).
The workaround is the GM needs to scroll to the bottom of the combatant lists ONCE, but the players need to scroll to the bottom of the minitracker every round. This... isn't going to work !
What I was wondering is if there is some way of getting all the subwindows to initialise programatically ? Might involve some trickery, as I don't see an API call for it...