#--------------------------------------------------------------------------
# ● 常量定义
#--------------------------------------------------------------------------
ENTER = 0x0D
SPACE = 0x20
UP = 0x26
DOWN = 0x28
LEFT = 0x25
RIGHT = 0x27
#--------------------------------------------------------------------------
# ● 单键处理
#--------------------------------------------------------------------------
def self.trigger?(rkey)
result = GetKeyState.call(rkey)
if @R_Key_Hash[rkey] == 1 and result != 0
return false
end
if result != 0
@R_Key_Hash[rkey] = 1
return true
else
@R_Key_Hash[rkey] = 0
return false
end
end
#--------------------------------------------------------------------------
# ● 设置活动标记
#--------------------------------------------------------------------------
def active=(value)
if value != true and value != false
return
end
@active = value
@caret_sp.visible = @active
end
if self.get_width(@text.to_s + char) <= @max_width
@text[@caret_pos,0] = char
@caret_pos += 1
else
break
end
end
refresh
end
end
#--------------------------------------------------------------------------
# ● 更新左右按键
#--------------------------------------------------------------------------
def update_lrb
if RInput.trigger?(RInput::LEFT) and @caret_pos > 0
@caret_pos -= 1
return
end
if RInput.trigger?(RInput::RIGHT) and @caret_pos < @text.size
@caret_pos += 1
return
end
end