RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[resolved] window display problem.

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 82
We learn by living...
I must be getting senile because I've forgotten what the solution this is, but basically, I've got a window accidentally displaying the right arrow. This is something that happens when adjusting the parameters of a window vs. its background images and something to do with a 16-32 pixel border, but for the life of me I can't recall where I messed up. Here's the window code, based heavily on the Window_Skill.

Code: [Select]

class Window_Chant < Window_Selectable
   #--------------------------------------------------------------------------
  # * Object Initialization
  #     This is the Spell Book Window: It is translucent
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 640, 352)
    @actor = actor
    @column_max = 3
    refresh
    self.index = -1
    # If in battle
    if $game_temp.in_battle
      self.width = 540 #100
      self.x = 100
      self.y = 64
      self.height = 214 #256
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # * Acquiring Chant
  #--------------------------------------------------------------------------
  def chant
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.chants.size
      chant = $data_chants[@actor.chants[i]]
      if chant != nil
        @data.push(chant)
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    chant = @data[index]
    if @actor.chant_can_use?(chant.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    if $game_temp.in_battle   
      x = 6 + index % 3 * (146 + 32)
      y = index / 3 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(chant.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 24, y, 160, 32, chant.name, 0)
      self.contents.draw_text(x + 94, y, 48, 32, chant.power.to_s, 2)
    else
      x = 4 + index % 3 * (180 + 32)
      y = index / 3 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(chant.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 204, 32, chant.name, 0)
      self.contents.draw_text(x + 124, y, 48, 32, chant.power.to_s, 2)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.chant == nil ? "" : self.chant.description)
  end
 
end

« Last Edit: April 22, 2011, 03:15:59 PM by shintashi »

**
Rep:
Level 82
The window contents is larger than the window.

For example, if you have a 320x240 window, but the contents for it is 320x480, you will see arrows at the top, bottom or both, depending on the origin point of the bitmap.

Basically, just size the window contents properly and they will go away. In your case though, it looks like they should be there, at least on the vertical axis. The refresh method sizes the contents to fit the number of items, which don't all fit within the window frame, therefore you get the arrows to show that there are more items that are unseen and need to be scrolled down/up to.

***
Rep:
Level 82
We learn by living...
The window contents is larger than the window.

For example, if you have a 320x240 window, but the contents for it is 320x480, you will see arrows at the top, bottom or both, depending on the origin point of the bitmap.

Basically, just size the window contents properly and they will go away. In your case though, it looks like they should be there, at least on the vertical axis. The refresh method sizes the contents to fit the number of items, which don't all fit within the window frame, therefore you get the arrows to show that there are more items that are unseen and need to be scrolled down/up to.

Right. So any idea which variable needs to be edited? When I have no content items (no chants), the arrow does not appear, but even when I have only one item listed, with a width of merely 40, in the center, the right arrow still appears. I've been messing with this for a couple of days now with no success.

***
Rep:
Level 82
We learn by living...
temp solution:

I took out "if in battle" and changed my super to 100..540, instead of 0..640 width. This gets rid of the arrow because the arrow is related to the original figures in the Super, and I don't know how to re-initiate the super with different numbers during battle.

**
Rep:
Level 82
Here is a little edit to your initialize method. It will have the window sized correctly for battle.

Code: [Select]
  def initialize(actor)
    if $game_temp.in_battle
      super(100, 64, 540, 100)
      self.back_opacity = 160
    else
      super(0, 128, 640, 352)
    end
    @actor = actor
    @column_max = 3
    refresh
    self.index = -1
  end

***
Rep:
Level 82
We learn by living...
excellent. Thanks much, I usually leave any part of code alone which I don't fully understand, and supers are something I'm not terribly familiar with.

**
Rep:
Level 82
To put it simply, they call the same method that they are in, but the parent's version. You supply the same arguments that the parent method requires, and it applies them to the child class. You can call it at any point that is convenient for your code, it doesn't have to be at the beginning, but for windows, it usually will be.

If you are familiar with aliases, think of it like that, where you can kind of determine where the old method is called within the aliased method by where you write the alias name.