OnKeyPress oddity
-
I am deriving a class from ComboBox. I override OnKeyPress. But OnKeyPress never gets called! Anyone knows whether there is anything special I need to be doing? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I am deriving a class from ComboBox. I override OnKeyPress. But OnKeyPress never gets called! Anyone knows whether there is anything special I need to be doing? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Well It's not an MC++ issue here. The same thing happens when I use C# :-( Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I am deriving a class from ComboBox. I override OnKeyPress. But OnKeyPress never gets called! Anyone knows whether there is anything special I need to be doing? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Ensure that IsInputKey/Char returns true for that key; if it returns false you won't get the OnKey* events. James Simplicity Rules!
-
Ensure that IsInputKey/Char returns true for that key; if it returns false you won't get the OnKey* events. James Simplicity Rules!
James T. Johnson wrote: Ensure that IsInputKey/Char returns true for that key; if it returns false you won't get the OnKey* events. You mean in addition to overriding OnKeyPress I also need to override IsInputKey ??? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Ensure that IsInputKey/Char returns true for that key; if it returns false you won't get the OnKey* events. James Simplicity Rules!
I did this :-
protected override bool IsInputKey(System.Windows.Forms.Keys keyData)
{
base.IsInputKey(keyData);
return true;
}But still OnKeyPress never gets called! Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I did this :-
protected override bool IsInputKey(System.Windows.Forms.Keys keyData)
{
base.IsInputKey(keyData);
return true;
}But still OnKeyPress never gets called! Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Use Anakrino. When you have anakrino you don't need to ask any quetions anywhere.:)
-
Use Anakrino. When you have anakrino you don't need to ask any quetions anywhere.:)
Rama Krishna wrote: Use Anakrino. When you have anakrino you don't need to ask any quetions anywhere How do I use Anakrino in this situation, Rama? My problem is that a handler is not getting called in the derived class despite the fact that I have overridden it :-( Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Use Anakrino. When you have anakrino you don't need to ask any quetions anywhere.:)
I overrode WndProc and found that the WM_KEYDOWN message is not being received :-(
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if(m.Msg == 0x0100)
Text = "Hello World";
}Nish p.s. In an MC++ program I can #include windows.h to get the defines for various messages, in a C# program how do I get the defines for messages. Above I have hardcoded 0x0100 [WM_KEYDOWN]
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I am deriving a class from ComboBox. I override OnKeyPress. But OnKeyPress never gets called! Anyone knows whether there is anything special I need to be doing? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Blast! Just found out that this is a bug in both beta 1 and beta 2 Nish p.s. Gotta try this from home now :mad:
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I overrode WndProc and found that the WM_KEYDOWN message is not being received :-(
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if(m.Msg == 0x0100)
Text = "Hello World";
}Nish p.s. In an MC++ program I can #include windows.h to get the defines for various messages, in a C# program how do I get the defines for messages. Above I have hardcoded 0x0100 [WM_KEYDOWN]
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Find in Files for WM_KEYDOWN ;P There are a couple programs out there which will let you get the constants but I find it much easier to just do a Find in Files. James Simplicity Rules!
-
I overrode WndProc and found that the WM_KEYDOWN message is not being received :-(
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if(m.Msg == 0x0100)
Text = "Hello World";
}Nish p.s. In an MC++ program I can #include windows.h to get the defines for various messages, in a C# program how do I get the defines for messages. Above I have hardcoded 0x0100 [WM_KEYDOWN]
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Incidentally there was a discussion about this in one of my articles Link Don't use WndProc, use PreProcessMessage.
-
Rama Krishna wrote: Incidentally there was a discussion about this in one of my articles Link Thanks. Checked it out! Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
How your article works. I see that OnKeyPress is getting called. :) Ofcourse highlighting text by mouse doesnot work in your combo box. :(
-
Find in Files for WM_KEYDOWN ;P There are a couple programs out there which will let you get the constants but I find it much easier to just do a Find in Files. James Simplicity Rules!
James T. Johnson wrote: Find in Files for WM_KEYDOWN Blast!!! Of all things, a Jambo joke!!! Boooohhhhhhhhh! We don't want Jambo jokes! Booooooooooo! We want jambo-edited articles ;-) Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Incidentally there was a discussion about this in one of my articles Link Don't use WndProc, use PreProcessMessage.
Rama Krishna wrote: Incidentally there was a discussion about this in one of my articles Link Thanks. Checked it out! Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
James T. Johnson wrote: Find in Files for WM_KEYDOWN Blast!!! Of all things, a Jambo joke!!! Boooohhhhhhhhh! We don't want Jambo jokes! Booooooooooo! We want jambo-edited articles ;-) Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Nish - Native CPian wrote: We want jambo-edited articles I'll get back to editing once I figure out what has caused me headaches the past 2 days. James Simplicity Rules!
-
How your article works. I see that OnKeyPress is getting called. :) Ofcourse highlighting text by mouse doesnot work in your combo box. :(
Rama Krishna wrote: How your article works It was a bug with beta 2. OnKeyPress won't get called in beta 2 :-) Rama Krishna wrote: Ofcourse highlighting text by mouse doesnot work in your combo box Huh? It does here :confused: Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Rama Krishna wrote: How your article works It was a bug with beta 2. OnKeyPress won't get called in beta 2 :-) Rama Krishna wrote: Ofcourse highlighting text by mouse doesnot work in your combo box Huh? It does here :confused: Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Nish - Native CPian wrote: It was a bug with beta 2. OnKeyPress won't get called in beta 2 I got it. I thought that it was still a bug:) Nish - Native CPian wrote: Huh? It does here Sorry It doesnot work for me. BTW don't you love the rating you got for the new article.
-
Nish - Native CPian wrote: It was a bug with beta 2. OnKeyPress won't get called in beta 2 I got it. I thought that it was still a bug:) Nish - Native CPian wrote: Huh? It does here Sorry It doesnot work for me. BTW don't you love the rating you got for the new article.
Rama Krishna wrote: BTW don't you love the rating you got for the new article. Yeah, about twice as much as my usual :-) Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.