Hello,
I am having some difficulty with the menu system I am working on. In one of my selectable windows, when I have enough items to scroll down, the items that should appear after scrolling down aren't being drawn. In the picture below, I have encircled in black the area where there should be items being drawn. When I first go to this window, it is completely full of items before scrolling down. The help window at the top is working properly, and the window is functional. The purpose of this window is to change jobs, and it should say "Poor Aeromancer" under the cursor. The associated help window has the help info for Aeromancer, and if I select this item it will change the character's job appropriately.

I am a little stumped on this one, and am not quite sure where to look to fix this. I would appreciate any help on how to find a way to get the jobs drawn after scrolling down. I know the menu itself looks a little rough; I am still working on it. I would appreciate any help on this issue.
Below is the code for the active window:
CODE
#This window is to select job-related items and equipment from the status menu.
#The contents will change depending from where it is accessed.
class Window_Status_Selection < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
attr_accessor :commands
attr_accessor :actor
attr_accessor :type
attr_accessor :return_index #1 for job section, 2 for equip section
attr_accessor :cancel_return
attr_accessor :ids
#This variable will hold the current job name. This will be used so the
#secondary job skills available for selection do not include the current job's
#skills.
attr_accessor :job_name
def initialize(x,y, width, height)
#Type is the type of thing to be displayed
#1 Job
#2 Secondary Skill
#3 Bonus
#4 Equipment
# Compute window height from command quantity
@cancel_return = 1#This is to determind whether to go back to the
#jobs menu or equip menu.
super(x, y, width, height)
@item_max = 1 #commands.size
@commands = [] #commands
@experience = []
@ids = [] #To hold weapon/armour ids
#@column_max = 1
#To hold the job descriptions
@descriptions = []
self.contents = Bitmap.new(width - 32, height - 32)
#Note. The bitmap needs to be big enough to show all items.
refresh
@index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case @type
when 0
when 1
self.contents.font.size = 20
@item_max = @actor.jobs.size
for i in 0...@actor.jobs.size
if @actor.jobs_levels[i] == $jp_curve.size
#bitmap = RPG::Cache.icon("Master")
@commands[i]=$ladder[@actor.jobs_levels[i]]+' '+@actor.jobs[i].name+\
' MASTER'
#self.contents.blt(30, 30 * (1+i), bitmap, Rect.new(0, 0, 24, 24), 255)
else
@commands[i]=$ladder[@actor.jobs_levels[i]]+' '+@actor.jobs[i].name+' '+\
@actor.jobs_exp[i].to_s+'/'+@actor.jobs_next[i].to_s
draw_item(i, normal_color)
end
draw_item(i, normal_color)
end
when 2
#Minus one because the current job's skills won't be shown.
@commands.clear
@item_max = @actor.jobs.size-1
j=0
for i in 0...@actor.jobs.size
if @actor.jobs[i].name != @job_name
@commands.push(@actor.jobs[i].name)
draw_item(j, normal_color)
j +=1
end
end
when 3
@commands.clear
@item_max = @actor.bonuses.size
j=0
for i in 0...@actor.bonuses.size
#Do not include bonus2 in the first list of bonuses.
if @actor.bonus2 != $data_skills[@actor.bonuses[i]].name
@commands.push($data_skills[@actor.bonuses[i]].name)
draw_item(j, normal_color)
j +=1
end
end
when 4
@commands.clear
@item_max = @actor.bonuses.size
j=0
for i in 0...@actor.bonuses.size
#Do not include bonus1 in the first list of bonuses.
if @actor.bonus1 != $data_skills[@actor.bonuses[i]].name
@commands.push($data_skills[@actor.bonuses[i]].name)
draw_item(j, normal_color)
j +=1
end
end
when 11 #I jumped up to 11 just to give me room from the jobs section.
set = $data_classes[@actor.class_id].weapon_set
@item_max = set.size
for i in 0...set.size
@commands[i] =$data_weapons[set[i]].name
@ids[i] = $data_weapons[set[i]].id
draw_item(i, normal_color)
end
end
#for i in 0...@commands.size
# draw_item(i, normal_color)
#end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color,align=0)#Added an align variable
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index],align)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
def update_help
case @type
when 1
set_descriptions
@help_window.set_text(@descriptions[@index],1) if @descriptions != nil
end
end
def set_descriptions
for i in 0...@actor.jobs.size
@descriptions[i] = @actor.jobs[i].description
end
end
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 32)
end
end