Re: OCR and alt platforms

new topic     » goto parent     » topic index » view thread      » older message » newer message

At 10:25 AM 7/31/99 -0400, Norm wrote:
>Does anyone know how to write a simple (!) EU routine that will allow one
>to use the Enter key rather than the leftside Mouse Click to activate an
>Event action in the same manner that that click would?   I have tried to
>write a clean one, and it is fairly straightforward to mimic everything
>else, but for some reason this escapes me.  Help!

Hi Norm,

Try this...

-- example code

include graphics.e  -- for sound() routine used in beep

procedure beep()
-- AT&T beep
    atom t
    sound(400) t = time()+.2 while time() < t do end while
    sound(700) t = time()+.2 while time() < t do end while
    sound(900) t = time()+.2 while time() < t do end while
    sound(0)
end procedure

procedure input_loop()
-- respond to keyboard or mouse input
    integer key_press
    while 1 do
        -- scan for key press
        key_press = get_key()
        if key_press = 13 then beep()  -- enter
        elsif key_press = 27 then exit  -- escape
        -- [scan for more keys...]
        end if
        -- [scan for mouse input here...]
    end while
end procedure

puts(1, "Press <Enter> for beep, <Esc> to quit...\n")
input_loop()

-- end code

Colin Taylor

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu