i need help with a script "show_sub_window(window)" any advice? or help??

**i'm not sure if i posted this in the right forum ;^~^

hiya, new here. i'm working on a personal game project where i created my own custom item menu script that compliments the "Menu Plus II" made by Takkun, for vx ace.
(it was just the default item menu, and my ocd wanted everything to match so that included the item menu so i made my own)

it's just best if i just show you to further explain -and/or confuse us both (somehow).
Here is what i adjusted so far'
Screenshot (22).png


but you can see, the window where you heal your character's (aka use items on your character's, aka the sub_window) it's at the top corner that's nice and all... but i don't like how it cut off half of the portion of my item menu,
and it just straight up throws everything off for me.

i did take a snippet from Tekkun's Menu Plus II script, the "Window_MenuStatus < Window_Selectable" bit. (Line_117 to 147) along side another snippets from the Scene_ItemBase < Scene_MenuBase

then combined these two snips unto a new script in a way to target the sub_window.
and i do know it will 'also' affect the magic/skill use on character, so is there a way i can just make it only affect the item use?
Spoiler
Code:
#==============================================================================#
# ► Window_MenuStatus + EDITED
#  *Snippet taken from Menu Plus II. *line_117 to 147*
#  *i'd like to leave this untouched, -if possible.
#==============================================================================#
class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ◆ Acquiring Window Width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width - 300  #300
  end
  #--------------------------------------------------------------------------
  # ◆ Window Height Acquisition
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - 248 #248
  end
  #--------------------------------------------------------------------------
  # ◆ Item Height Acquisition
  #--------------------------------------------------------------------------
  def item_height
    (height - standard_padding * 2) / 2
  end
  #--------------------------------------------------------------------------
  # ◆ Drawing an Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    actor = $game_party.members[index]
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    draw_actor_graphic(actor, rect.x + 25, rect.y + 55)
    draw_actor_neo_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  end
end

#==============================================================================#
# ** Scene_ItemBase + EDITED
# ** taken from Scene_ItemBase in the script editor.
#------------------------------------------------------------------------------#
#  This class performs common processing for the item screen and skill screen.
#==============================================================================#

class Scene_ItemBase < Scene_MenuBase

  #--------------------------------------------------------------------------
  # * Determine if Cursor Is in Left Column *EDITED
  #--------------------------------------------------------------------------
  def cursor_left?
    @item_window.index % 2 == 0
  end
  #--------------------------------------------------------------------------
  # * Show Subwindow *EDITED
  #--------------------------------------------------------------------------
  def show_sub_window(window)
    width_remain = Graphics.width - window.width
    window.x = cursor_left? ? width_remain : 0
    window.x = 232 #moving the sub_window position
    window.y = 100 #also moving sub_window
    @viewport.rect.x = @viewport.ox = cursor_left? ? 0 : window.width
    @viewport.rect.width = width_remain
    window.show.activate
  end
  #--------------------------------------------------------------------------
  # * Hide Subwindow
  #--------------------------------------------------------------------------
  def hide_sub_window(window)
    @viewport.rect.x = @viewport.ox = 0
    @viewport.rect.width = Graphics.width
    window.hide.deactivate
    activate_item_window
  end
end

which in turn, resulted in'
Screenshot (25).png


which is also so very close to where i want it to be ! but the problem is still there,
the large portion of the item menu is cut off.
(i believe its the viewport? how do i edit that? is it so simple to edit things like that? someone please explain)

Here is an example of what i wanted the sub window to look like' (Photoshopped)
Screenshot (000).png


also i am not a professional scripter, i learn as i go..
i'd appreciate any help and advice, thank you
This is a viewport problem. And this is probably hard to understand at start, but very convenient if you know how to use it.

Here's a sample code that demonstrates the viewport. Put it as a new script, then try to press the left/right directional button.
Code:
DataManager.init
rect = Rect.new(0,0,Graphics.width, Graphics.height)
@viewport = Viewport.new(rect)
@window = Window_Base.new(0,0, Graphics.width, Graphics.height)
@window.viewport = @viewport

loop do
  Graphics.update
  Input.update
  if Input.press?(:LEFT)
    @viewport.rect.width -= 5
  elsif Input.press?(:RIGHT)
    @viewport.rect.width += 5
  end
end
Now once you know how the viewport works. This is what actually happening.
Screenshot_348.jpg

The reason for shrinking is simply because they don't want to overlap the actor sub-menu with the item. Now that you edited the menu, it does look weird.

If you want it to behave as you wanted, that is a bit complicated. You need like 4 viewports for it.
Screenshot_349.jpg
Close, this is better in the forum for learning RGSSx. I'll move it there.
This is a viewport problem. And this is probably hard to understand at start, but very convenient if you know how to use it.

Here's a sample code that demonstrates the viewport. Put it as a new script, then try to press the left/right directional button.
Code:
DataManager.init
rect = Rect.new(0,0,Graphics.width, Graphics.height)
@viewport = Viewport.new(rect)
@window = Window_Base.new(0,0, Graphics.width, Graphics.height)
@window.viewport = @viewport

loop do
  Graphics.update
  Input.update
  if Input.press?(:LEFT)
    @viewport.rect.width -= 5
  elsif Input.press?(:RIGHT)
    @viewport.rect.width += 5
  end
end
Now once you know how the viewport works. This is what actually happening.
View attachment 139489
The reason for shrinking is simply because they don't want to overlap the actor sub-menu with the item. Now that you edited the menu, it does look weird.

If you want it to behave as you wanted, that is a bit complicated. You need like 4 viewports for it.
View attachment 139488

Sorry for the late reply !!
your explanation actually helped, a little confusing at first, but i managed to slightly figure out how viewports work and how to use them. i got away with only creating an extra viewport (the itemlist) and fiddling around to the point where i got the result i wanted XD
Screenshot (31).png


thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-with-a-script-show_sub_window-window-any-advice-or-help.120072/