delphi - KeyDown KeyPress Conundrum - How to cancel the Space in Ctrl + Space -


if understand correctly, keydown event cannot stop character key (space) being passed control.

but keypress event doesn't tell me whether ctrl down.

but need cancel space if ctrl down.

how can prevent edit control receiving space keypress if ctrl down?

purpose: have text box, making search suggestions. want pop suggestions using short cut ctrl+space. in case, don't want add space edit text.

the keypress event doesn't tell me whether ctrl down.

no, can use win32 getkeystate() function instead.

how can prevent edit control receiving space keypress if ctrl down?

like this:

procedure tform58.edit1keypress(sender: tobject; var key: char); begin   if (key = ' ') , (getkeystate(vk_control) < 0)   begin     key := #0;     // something...   end; end; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -