GPIW Refresh

Does anybody know what triggers a Game Piece Inventory Window to automatically refresh? I’ve noticed that sometimes performing a command on a Piece displayed in the window triggers a refresh, while other times it does not. The behavior is predictable and consistent but I haven’t been able to figure out which changes to a Piece’s state cause the refresh. It would be useful to know because I’d like to use that indirectly as a means to refresh GPIWs automatically as opposed to a player needing to click refresh manually.

It looks like a refresh is done:
(a) When the window’s visibility changes (i.e. opening and closing)
(b) When you click the refresh button (duh)
(c) When a Key Command that produces a non-null gamestate effect is forwarded by the window to a piece.

I wonder if the Key Command “forwarding” is only happening with actual keystrokes and not with right-click context menu? if you want to poke around.

I frequently use the GPIW to filter pieces so that players can see at a glance, all units that are eligible for a command. I’ve got a right-click menu command in 2 different GPIWs that does the same exact thing, replace the selected piece with a new piece. One triggers a refresh (removing the replaced piece) and the other does not. I can’t figure out for the life of me, why it’s triggering with one and not the other. I could just add a trigger to force a refresh by invoking the GPIW’s global hotkey, but I’m stubborn and would rather know what’s going on and implement it the cleaner way.

I’ve concluded the difference must be in the behavior of the pieces in the GPIW. One window is naval units and the other is land units. My thought is that one or more right-click options get toggled from hidden to visible or vice versa and that triggers the refresh. But the thing is, the property that qualifies a unit for appearing in the GPIW (Activated>0) gets changed to zero every time a command is performed which seems like an obvious non-null gamestate effect, so not sure why it doesn’t trigger a refresh every time.

I did some further investigation and your supposition was correct. The Key Command “forwarding” is only consistently happening with keystrokes. Sometimes the right-click refreshes the GPIW, sometimes it does not. The behavior is consistent so I’m going to try to isolate which right-clicks are “forwarded” and which are not…