MV How to get the "selected item" object into a Window object? (SOLVED)

Been trying to figure this out now for some time, and so far I've been sliding along on stealing the this._item from other windows to make it work. But I really feel I am missing something important... I've gone over both Shop and Equip scene and I don't find anything that seems to get the selected item from the window list. There's some things like W.setItem(item). But then you need to put in an item as an argument, and these functions seem to set the item for other functions.

Thanks for all help! 🙂

Was unclear in my last question, so sleepy and brain is exhausted from seeing nothing but code for 15 hours 😛 But I hope these pictures, from the console, explains what I want.
**************************************
1634859221754.png

**************************************
1634859249903.png

**************************************
So just like in the shop(Scene)'s statusWindow I want the equipScene's statusWindow to have the _item object as well :/

Best regards,
Bishiba
When a scene creates a selectable window, it typically assigns handlers for various responses, e.g.
JavaScript:
Scene_Equip.prototype.createItemWindow = function() {
// ...
    this._itemWindow = new Window_EquipItem(wx, wy, ww, wh);
    this._itemWindow.setHelpWindow(this._helpWindow);
    this._itemWindow.setStatusWindow(this._statusWindow);
    this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
    this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
// ...
};
Since the responses are methods of the scene, this makes it easy to access other windows, e.g.
JavaScript:
Scene_Equip.prototype.onItemOk = function() {
    SoundManager.playEquip();
    this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item());
// ...
};
Basically, windows handle their own stuff, and the scene handles interactions between them.

(Usually, anyway.)
When a scene creates a selectable window, it typically assigns handlers for various responses, e.g.
JavaScript:
Scene_Equip.prototype.createItemWindow = function() {
// ...
    this._itemWindow = new Window_EquipItem(wx, wy, ww, wh);
    this._itemWindow.setHelpWindow(this._helpWindow);
    this._itemWindow.setStatusWindow(this._statusWindow);
    this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
    this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
// ...
};
Since the responses are methods of the scene, this makes it easy to access other windows, e.g.
JavaScript:
Scene_Equip.prototype.onItemOk = function() {
    SoundManager.playEquip();
    this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item());
// ...
};
Basically, windows handle their own stuff, and the scene handles interactions between them.

(Usually, anyway.)
Trying to send the currently selected item in the itemlist of the equipmenu to the status menu. So That is what I am trying to do right now :/
Notice this line from my previous post, in the first block of code I quoted:
JavaScript:
    this._itemWindow.setStatusWindow(this._statusWindow);
This gives the item window a reference to the corresponding status window:
JavaScript:
Window_EquipItem.prototype.setStatusWindow = function(statusWindow) {
    this._statusWindow = statusWindow;
    this.callUpdateHelp();
};
The item window can then use this reference to send data to the status window:
JavaScript:
Window_EquipItem.prototype.updateHelp = function() {
    Window_ItemList.prototype.updateHelp.call(this);
    if (this._actor && this._statusWindow) {
        var actor = JsonEx.makeDeepCopy(this._actor);
        actor.forceChangeEquip(this._slotId, this.item());
        this._statusWindow.setTempActor(actor);
    }
};
In this case it's a "temporary actor", used to determine the change in stats that would result from equipping the selected item. 👋
Notice this line from my previous post, in the first block of code I quoted:
JavaScript:
    this._itemWindow.setStatusWindow(this._statusWindow);
This gives the item window a reference to the corresponding status window:
JavaScript:
Window_EquipItem.prototype.setStatusWindow = function(statusWindow) {
    this._statusWindow = statusWindow;
    this.callUpdateHelp();
};
The item window can then use this reference to send data to the status window:
JavaScript:
Window_EquipItem.prototype.updateHelp = function() {
    Window_ItemList.prototype.updateHelp.call(this);
    if (this._actor && this._statusWindow) {
        var actor = JsonEx.makeDeepCopy(this._actor);
        actor.forceChangeEquip(this._slotId, this.item());
        this._statusWindow.setTempActor(actor);
    }
};
In this case it's a "temporary actor", used to determine the change in stats that would result from equipping the selected item. 👋
Yes, as you've noticed I did just comment on that post. Then I saw this. Alright, I shall look into this a bit more. This might be the better way to do it rather than my answer on the other thread. These two threads should've probably been the same to be honest.

Been going over it and I understand it now! 😀

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-get-the-selected-item-object-into-a-window-object-solved.141444/