![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
How to let Enter-key-press message goes to ActiveX control on dialogI have next problem,
I have dialog and Grid (ActiveX control) on it. But when I edit some cell and then press Enter, dialog closes. To not do this, I redefine CDialog::OnOK() in my dialog-class, and make this function empty. So, when I press Enter this time, nothing (!) happens. Neither dialog closes nor Grid act like he must. What I have to do that Grig will be react on Enter key press (like he react correct on other keys, like F2) Thank you, sorry for my English Yura |
|
#2
|
||||
|
||||
|
I don't have much experience with ActiveX controls....
However, with standard MFC controls, all you have to do is implement the KEYDOWN event for the respective control, and then check if the key that you are interested in has been pressed. This is a simple example of catching the pressing of the Delete key inside the list control: CPP / C++ / C Code:
However, you probably know all this, so my post may not fix your problem :-( Tell me if it helps, though.... Best regards, Luci __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#3
|
|||
|
|||
ThankZThank you, Luci, for answering!
You see, that grid knows how to react on the such keys like Enter or F2, the problem is to correctly translate the Enter-key press to this control, because dialog "want" to press a default key on pressing enter and so on. If I use an empty redefined OnOK() function, dialog not closes (because CDialog::OnOK() not called at all), but grid also "don't know" that I press Enter key. Bad, but a little helpful solution is: ----------------------------------------------------------------- Code:
this cause that effect that I want, but surprisingly it doesn't work when dialog is situated on Tab of CTabCtrl This connected with MFC mechanism of Message translation. I don't know how to manage with that on that minute, but I planned to research how do that works and find out solution. If you have some information or ideas, please write. Thank you, Yura. Last edited by JdS : 08-Sep-2004 at 09:20.
Reason: Please insert your example codes between [code] and [/code] tags
|
|
#4
|
||||
|
||||
|
Quote:
Did you add the KeyPress Stock Event? Quote:
Yes, the CTabCtrl sends the notification messages to it's parent and needs it to handle them.... Please read this article: http://www.codeguru.com/Cpp/W-D/disl...cle.php/c4965/ Regards, Luci __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
Recent GIDBlog
US Elections and the ?Voter?s Responsibility? by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The