Thanks Jano,
Could make a sample for it? Or give me the related API? Thanks.
And, want to catch the event, not only catch the what user input after
press [Enter], thanks.
Marble
Thanks Jano,
Could make a sample for it? Or give me the related API? Thanks.
And, want to catch the event, not only catch the what user input after
press [Enter], thanks.
Marble
On 7/3/07, [email protected] [email protected] wrote:
Thanks Jano,
Could make a sample for it? Or give me the related API? Thanks.
And, want to catch the event, not only catch the what user input after
press [Enter], thanks.
Hi,
this is how you can obtain pressed keys on windows:
require ‘Win32API’
module Windows
module Keyboard
Getch = Win32API.new(‘crtdll’, ‘_getch’, ‘V’, ‘L’)
Kbhit = Win32API.new(‘crtdll’, ‘_kbhit’, ‘V’, ‘L’)
def getch
Getch.call
end
def kbhit
Kbhit.call
end
end
end
and this is how you can use readline library to prompt and provide
completion:
require ‘readline’
Readline.completion_proc = proc {|word| [‘array’, ‘of’, ‘possible’,
‘completions’]}
line = Readline.readline(“prompt>”, true) # true means history on
J.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs