Basically, I want both windows to be active simultaneously. Only one of them has any actual functions attached to it, so I'm not really concerned with the other's functionality beyond mirroring any input the functional window receives.
I am able to do this if I open the console while the first window is active, and typing in SceneManager._scene._myWindow.activate(); and the behavior works perfectly, with both windows scrolling through their items as I desired. I just can't figure out how to do so with an if condition in my plugin. I want it to function as "If window A is active, activate window B". Cancelling out of the menu should likewise Deactivate Window B. Entering a different scene should also deactivate the window B.
Sorry if I don't get back to this quickly. My thanks in advance!
I suggest you take a step back and describe to us the results of what you want to do and NOT how you want to do that.
Having more than one window active is problematic due to the side effects and the input timing problems that might cause - and the way you describe it tells me you don't care about those either and are only using overrides to get the activity for a completely different effect.
So it might be much easier to tell us about the effect you want to have in your project, and let the experts check if there are other ways to achieve that.
Sure, I have a list window with different items drawing the actors names and gauges in the party built from a Window_MenuStatus object, and I have another window that draws a box that displays graphics from my img/pictures folder of an associated actor. The window that is displaying graphics is currently created from the Window_MenuStatus class as well, and only displays one graphic at a time, with others only appearing when scrolling down.
The desired effect is that when selecting something like "Status" from the Menu, and activating the StatusMenu window, it also activates the list window that was built so that the actor selected in one is mirrored in the other.
I could try just drawing the image in a window constructed from Scene_Base I guess, and take back the Window_MenuStatus class for my list, but I liked having both drawing a selection rectangle... That and I already figured out all the positional information to draw everything where I want it.
Solved. A few things in case anyone wants to do this:
Andar is correct, this is normally a really bad idea, since you can have all sorts of weird and nasty bugs when doing this including errors, overloads, unusual behaviors, the gamut. The fact it took me most of two weeks to work out these bugs is something to note, but because my specific use-case is solely confined to the fairly static Main Menu, rather than in a situation with more engaging gameplay, I was willing to do something less than advisable in order to achieve a desired effect.
Because I was drawing a window constructed from Window_MenuStatus, and initializing also a Window_Selectable, I had the methods of both of these classes available to me. In Scene_Menu's constructor, which I had to add methods to in my plugin anyway, I wrote a call() for both windows I wanted to draw.
I then added to Scene_Menu the following methods: commandPersonal and onPersonalCancel.
Both of these methods are available in Scene_Menu anyway, so I'm simply redefining and adding to them here. I added to commandPersonal the following:
this._myFirstWindow.setFormationMode(false);
this._myFirstWindow.selectLast();
this._myFirstWindow.activate();
this._mySecondWindow.setFormationMode(false);
this._mySecondWindow.selectLast();
this._mySecondWindow.activate();
this._myFirstWindow.setHandler('ok', this.on
PersonalOk.bind(this));
this._myFirstWindow.setHandler('cancel', this.onPersonalCancel.bind(this));
Because mySecondWindow (for my specific situation) has no defined actions to take when hitting OK, and myFirstWindow is the only window that I want to actually do something when hitting OK, I do not set any handlers for mySecondWindow. The handlers for myFirstWindow are the only ones I want active and I'd heavily suggest NOT giving handlers to mySecondWindow. Not that I'm sure what would actually happen... I haven't tried it and really don't want to know. myFirstWindow in this case is statusWindow.
In onPersonalCancel I added the following:
this._myFirstWindow.deselect();
this._mySecondWindow.deselect();
this._mySecondWindow.deactivate();
this._commandWindow.activate();
}
It was very important to make sure onPersonalCancel deactivates mySecondWindow to prevent a lot of problems. If you don't deactivate it, simply pageup or pagedown on the commandWindow causes the window to reactivate and desync with myFirstWindow. This is probably due to this.reselect being in rpg_windows.js's deactivate function for Window_Selectable, but I'm not entirely sure. Deselection is optional but visually important for the player.