Project1

标题: Window_Selectable [打印本页]

作者: NaturalBlue    时间: 2009-1-16 22:03
标题: Window_Selectable
Window_Selectable中控制窗口滚动的方法是哪几个?
O(∩_∩)O谢谢! [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 雪流星    时间: 2009-1-16 22:05
  1.   #--------------------------------------------------------------------------
  2.   # ● 計算行數
  3.   #--------------------------------------------------------------------------
  4.   def row_max
  5.     return (@item_max + @column_max - 1) / @column_max
  6.   end
  7.   #--------------------------------------------------------------------------
  8.   # ● 獲取首行
  9.   #--------------------------------------------------------------------------
  10.   def top_row
  11.     return self.oy / WLH
  12.   end
  13.   #--------------------------------------------------------------------------
  14.   # ● 設置首行
  15.   #     row : 顯示在最上的行
  16.   #--------------------------------------------------------------------------
  17.   def top_row=(row)
  18.     row = 0 if row < 0
  19.     row = row_max - 1 if row > row_max - 1
  20.     self.oy = row * WLH
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 獲取一頁能顯示的行數
  24.   #--------------------------------------------------------------------------
  25.   def page_row_max
  26.     return (self.height - 32) / WLH
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 獲取一頁能顯示的選項
  30.   #--------------------------------------------------------------------------
  31.   def page_item_max
  32.     return page_row_max * @column_max
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 獲取末行
  36.   #--------------------------------------------------------------------------
  37.   def bottom_row
  38.     return top_row + page_row_max - 1
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 設置末行
  42.   #     row : 顯示在最底的行
  43.   #--------------------------------------------------------------------------
  44.   def bottom_row=(row)
  45.     self.top_row = row - (page_row_max - 1)
  46.   end
复制代码
[LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1