Jump to content

Keyboard macros: Difference between revisions

add Ruby
(add language: Retro)
(add Ruby)
Line 277:
 
<lang Retro>devector getc</lang>
 
=={{header|Ruby}}==
{{libheader|Shoes}}
Here's a sample from the Shoes manual showing how to capture key sequences. This is application specific.
 
<lang ruby>Shoes.app do
@info = para "NO KEY is PRESSED."
keypress do |k|
@info.replace "#{k.inspect} was PRESSED."
end
end</lang>
 
A more specific example, using the emacs bindings
 
<lang ruby>Shoes.app do
keypress do |key|
case key
when \x18 # control-x
@ctrl_x = true
when \x13 # control-s
if @ctrl_x
save_text
@ctrl_x = false
end
when \x11 # control-q
exit if @ctrl_x
end
end
end</lang>
 
=={{header|Tcl}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.