return_scene and window handlers

● ARCHIVED · READ-ONLY
Started by Rime 5 posts View original ↗
  1. Why doesn't the @window get disposed when pressing :B despite having a cancel handler?

    Code:
    class Scene_Test < Scene_Base  def start    super    @window = Window_Selectable.new(0, 0, 100, 100)    @window.set_handler(:cancel, method(:return_scene))  end    def update    super  end    def terminate    super    @window.dispose  end  end
  2. @Rime,

    You gotta activate the window for it to register input.
  3. Window_Selectable is not activated at the first time the instance is initialized. That is why cancel button won't work.

    You need to activate the window by adding this line

    @window.activateAlso, you don't need to put @window.dispose in terminate since windows will always disposed each scene changed by default.
  4. @Mr. Trivel, @TheoAllen - Thank you for your responses. I don't know much about what activation does, so I'll read up on that. =)

    EDIT:
     

    Why doesn't the Scene_Menu's @command_window not have a...

    @command_window.activate ...line except when leaving a personal command or cancelling from formation? How does it get activated when the scene is created?

    Is activating a window similar to giving it "focus"? (So the game knows which Window to perform processes on in case of multiple windows appearing on the screen?)
  5. It's activated inside the Window_Command (since Window_MenuCommand is inherited from it)

    Try to look at its "def initialize"

    activate Window_Selectable and its sub-classes give you a control over the cursor. If you activate two windows or more, the you can control both cursor. But, do not do that lol. Yes, it's to determine which one is performing the process