Window process for drawing item cursor

Sorry in advance for the constant dumb-question posts (shout-out to TheoAllen in particular),

Just curious where the process that draws the cursor rectangle that highlights selected items is? In other words, the little box in the bottom-right corner of the Windowskin. I'm trying to make it so that Window_EquipCommand hides the selecting rectangle, but I'm not sure what processes to use because I can't find it anywhere.

As always, any and all help is appreciated!
Open your scripts window, ctrl+shift+F and find draw_cursor and find the top one that says def draw_cursor

Iirc, that process is on Window_Selectable or Window_Command which are the parents of the command windows
There isn't a process "draw_cursor." There's "update_cursor" which does this:
Code:
  def update_cursor
    if @cursor_all
      cursor_rect.set(0, 0, contents.width, row_max * item_height)
      self.top_row = 0
    elsif @index < 0
      cursor_rect.empty
    else
      ensure_cursor_visible
      cursor_rect.set(item_rect(@index))
    end
  end
But that just sets the rectangle for contents to be drawn in. This is the process that is called to set the rectangle though:
Code:
  def item_rect(index)
    rect = Rect.new
    rect.width = item_width
    rect.height = item_height
    rect.x = index % col_max * (item_width + spacing)
    rect.y = index / col_max * item_height
    rect
  end
However, rect.opacity returns an error, and it appears "Rect" is code inherent to the editor since it can't be edited with the same properties as Bitmap or Plane. The current solution is just using "self.windowskin" in Window_EquipCommand to set the window to a graphic with no cursor. But I'd still really like to know how to hide the cursor in the first place rather than do that.
If you're eager to learn from the basic, paste this in your project, playtest. Then use right/left button.
Code:
DataManager.init
$w = Window_Base.new(0,0,Graphics.width,48)
$cw = 1
$w.cursor_rect.set(0,0,$cw,24)

loop do
  Graphics.update
  Input.update
  $cw += 5 if Input.press?(:RIGHT)
  $cw -= 5 if Input.press?(:LEFT)
  $w.cursor_rect.set(0,0,$cw,24)
  $w.update
end
But tl;dr, it's cursor_rect.
Awesome Theo, thanks for the little demo too. The third element is opacity, then? This should be a huge help going forward with remodeling my menus. As an example...

3iT8ojA.png


I created the command window up top just now using this method. Instead of a cursor, the selected item lights up yellow. No more blue bar!
What do you mean by third element?
Awesome menu design btw.
'Script Support' is, in a general sense, more for help in getting an existing script to work the way you want/hope.

Moderator note: I'm moving this to Learning Ruby and RGSSx as this query seems to be more about how to script something.
Whoops, I think I meant to put this in Learning Ruby. That's probably where I'll frequent from now on.

@TheoAllen Nvm on that, I forgot I was still using the Windowskin with no cursor. Using item_width is actually something I've tried before, but making it 0 returned a division error. Is there any way to access the opacity of cursor_rect? Also thanks for the kind words! 🙂
Cursor has no opacity unfortunately. So you can't change it. Besides, the cursor will be fading in/out, so it makes no sense if their opacity can be changed.

The method item_width may still necessary to exist. Since aside from being used for cursor box, it used by "item_rect" to draw your window content, so do not change it. If you wish to hide cursor, make it so that it won't be using that.

I believe the easiest way to deal with it is just to replace the update_cursor method to always make cursor_rect empty.
Code:
  def update_cursor
    cursor_rect.empty
  end
This way, your window never show any cursor.
That seems like the smart way to do it if you can't adjust opacity. I'll test it out tomorrow in a different Window to make sure it works.

Original thread: https://forums.rpgmakerweb.com/threads/window-process-for-drawing-item-cursor.97591/