1. How to capture return key in an edit control

I need to capture the return key when entered in a multiedit or richedit control by a user. I am a newbie with simple project I think I can complete if I can figure this out. So far docs,faq, and tutorials have not helped me accomplish this.

I am thinking about using maybe onchange , keyup, keypress, or keyget to check each key. But do not know enough about these to accomplish task.

Thanks for any help.

new topic     » topic index » view message » categorize

2. Re: How to capture return key in an edit control

tmathis said...

I need to capture the return key when entered in a multiedit or richedit control by a user.

Does this help ...

without warning 
include win32lib.ew 
constant 
    main=create(Window,"Capture ENTER key",0, 100, 200, 250, 150, 0), 
    in=create(RichEdit,"",main,50,10,150,100,0) 
 
procedure esc(integer self, integer event, sequence params) 
    integer keycode 
    keycode=params[1] 
    if keycode=VK_RETURN then 
        setText(in,"<RETURN>") 
        returnValue(-1) -- Make the app ignore this keystroke. 
    end if 
end procedure 
setHandler(in,w32HKeyPress,routine_id("esc")) 
 
WinMain({main,in},Normal) 
 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu