CEdit will not accept text. What do I do?

Here is the scenario. I have a dialog which owns a popup window which
owns a cedit control. When I set the focus to the edit control the
caret blinks in the control and I can use the following keys: Insert,
delete, home, end, page up, page down, and the arrow keys. I can't type
any character into the control. I can highlight text and delete it, I
can right click and paste into the control, but when I hit a letter,
number or symbol key nothing happens. I have placed a break point in
the control's OnKeyUp and OnKeyDown functions and the points are hit. I
have even tried calling OnChar from the OnKeyDown, but still nothing
happens. Please tell me what I'm doing wrong.

0
11/13/2006 5:30:48 PM
vc.mfc 33608 articles. 0 followers. Follow

10 Replies
573 Views

Similar Articles

[PageSpeed] 7

Cliff wrote:
> Here is the scenario. I have a dialog which owns a popup window which
> owns a cedit control. When I set the focus to the edit control the
> caret blinks in the control and I can use the following keys: Insert,
> delete, home, end, page up, page down, and the arrow keys. I can't type
> any character into the control. I can highlight text and delete it, I
> can right click and paste into the control, but when I hit a letter,
> number or symbol key nothing happens. I have placed a break point in
> the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> have even tried calling OnChar from the OnKeyDown, but still nothing
> happens. Please tell me what I'm doing wrong.

See if it has a PreTranslateMessage which is precluding these chars to
get to it. There has to be something there which is doing this. It does
appear that your control is enabled and its not readonly.

---
Ajay

0
ajaykalra (6842)
11/13/2006 5:51:55 PM
Cliff wrote:
> Here is the scenario. I have a dialog which owns a popup window which
> owns a cedit control. When I set the focus to the edit control the
> caret blinks in the control and I can use the following keys: Insert,
> delete, home, end, page up, page down, and the arrow keys. I can't type
> any character into the control. I can highlight text and delete it, I
> can right click and paste into the control, but when I hit a letter,
> number or symbol key nothing happens. I have placed a break point in
> the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> have even tried calling OnChar from the OnKeyDown, but still nothing
> happens. Please tell me what I'm doing wrong.

See if it has a PreTranslateMessage which is precluding these chars to
get to it. There has to be something there which is doing this. It does
appear that your control is enabled and its not readonly.

---
Ajay

0
ajaykalra (6842)
11/13/2006 5:51:58 PM
I'm not sure what you're trying to do, but could you call CEdit::OnWhatever 
before or after your code that you added?

"Cliff" wrote:

> Here is the scenario. I have a dialog which owns a popup window which
> owns a cedit control. When I set the focus to the edit control the
> caret blinks in the control and I can use the following keys: Insert,
> delete, home, end, page up, page down, and the arrow keys. I can't type
> any character into the control. I can highlight text and delete it, I
> can right click and paste into the control, but when I hit a letter,
> number or symbol key nothing happens. I have placed a break point in
> the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> have even tried calling OnChar from the OnKeyDown, but still nothing
> happens. Please tell me what I'm doing wrong.
> 
> 
0
Saul775 (62)
11/13/2006 5:52:01 PM
You mentioned that this is a CEdit control, but that you are checking the 
function for it.  Did you derive your own control froM CEdit?  If so you may 
want to try it with the standard control to see if that works OK and that 
would point to the new control as the problem.  Also, are you using the 
control anywhere else successfully?

Tom

"Cliff" <cliff.newton@gmail.com> wrote in message 
news:1163439048.142829.106370@b28g2000cwb.googlegroups.com...
> Here is the scenario. I have a dialog which owns a popup window which
> owns a cedit control. When I set the focus to the edit control the
> caret blinks in the control and I can use the following keys: Insert,
> delete, home, end, page up, page down, and the arrow keys. I can't type
> any character into the control. I can highlight text and delete it, I
> can right click and paste into the control, but when I hit a letter,
> number or symbol key nothing happens. I have placed a break point in
> the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> have even tried calling OnChar from the OnKeyDown, but still nothing
> happens. Please tell me what I'm doing wrong.
> 


0
tserface (3861)
11/13/2006 9:03:11 PM
Ok, I've checked for anything that would override the onChar function.
There isn't a PreTranslateMessage function in any of the classes (the
dialog, popup window, or edit control). I've also checked the three
classes for WindowProcs that may have a handler that would prevent the
edit from processing the WM_CHAR message. There are a couple of OnKeyUp
handlers and even a handler in a WindowProc, but even upon removing all
of those handlers the OnChar still doesn't place any characters in the
edit control. Like I said earlier the OnKeyDown is getting called and I
call OnChar from my overridden onKeyDown. The only thing that I can
come up with is that either my edit has a style set wrong, or for some
reason, the OnChar never interprets the character as a non-system
character.
Here is my code for creating the edit control.

m_Edit.CreateEx (WS_EX_CLIENTEDGE | WS_EX_TOPMOST, _T("EDIT"), "",
ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD | WS_VISIBLE, Rect, this, 8000);

Thanks for any help :)


On Nov 13, 11:51 am, "Ajay Kalra" <ajayka...@yahoo.com> wrote:
> Cliff wrote:
> > Here is the scenario. I have a dialog which owns a popup window which
> > owns a cedit control. When I set the focus to the edit control the
> > caret blinks in the control and I can use the following keys: Insert,
> > delete, home, end, page up, page down, and the arrow keys. I can't type
> > any character into the control. I can highlight text and delete it, I
> > can right click and paste into the control, but when I hit a letter,
> > number or symbol key nothing happens. I have placed a break point in
> > the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> > have even tried calling OnChar from the OnKeyDown, but still nothing
> > happens. Please tell me what I'm doing wrong.See if it has a PreTranslateMessage which is precluding these chars to
> get to it. There has to be something there which is doing this. It does
> appear that your control is enabled and its not readonly.
> 
> ---
> Ajay

0
11/13/2006 9:11:30 PM
> m_Edit.CreateEx (WS_EX_CLIENTEDGE | WS_EX_TOPMOST, _T("EDIT"), "",
> ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD | WS_VISIBLE, Rect, this, 8000);

There is nothing here which will preclude some chars. Is m_Edit of type
CEdit or is it your class derived from CEdit? Can you make it CEdit
instead(if its of different class) and see if that makes any
difference?

---
Ajay

0
ajaykalra (6842)
11/13/2006 9:17:40 PM
Yes, this is a class derived from CEdit, and I have tried the base
CEdit and it still didn't work. In my hasty posting I forgot to mention
that the popup window is a class derived from the CTreeCtrl. My derived
tree is a tree with checkboxes beside each item (not actual check boxes
just images). The user can check or uncheck each of these boxes. This
control works fine, but I need to add the ability to allow the user to
add more items to the check list. I wanted to just use the edit labels
style of the tree to accomplish this, but I only wanted the user to be
able to edit one label in particular so I dropped the edit labels idea.
Now I am taking the course of loading the tree and having one node at
the top that the user can edit. The user can double click this item and
my derived edit control will show up. The edit control will
auto-suggest items that are already in the list below (just in case the
user overlooks an item). Upon pressing enter in the edit control the
tree will do one of two things. 1) If the item that was typed in is
already in the list then the tree will check that item and hide the
edit control or 2) add the new item and check it.

Whew, with that being said I can tell you this. I tried the edit labels
style just for the heck of it and even then I couldn't enter any
characters into the edit that shows up by default. (The edit for the
CTreeCtrl that is).

Ok, I know that was a lot of info left out on the first post, but I'm
at work and well time is always short.

Thanks ahead of time for any help.

On Nov 13, 3:03 pm, "Tom Serface" <tserf...@msn.com> wrote:
> You mentioned that this is a CEdit control, but that you are checking the
> function for it.  Did you derive your own control froM CEdit?  If so you may
> want to try it with the standard control to see if that works OK and that
> would point to the new control as the problem.  Also, are you using the
> control anywhere else successfully?
>
> Tom
>
> "Cliff" <cliff.new...@gmail.com> wrote in messagenews:1163439048.142829.106370@b28g2000cwb.googlegroups.com...
>
> > Here is the scenario. I have a dialog which owns a popup window which
> > owns a cedit control. When I set the focus to the edit control the
> > caret blinks in the control and I can use the following keys: Insert,
> > delete, home, end, page up, page down, and the arrow keys. I can't type
> > any character into the control. I can highlight text and delete it, I
> > can right click and paste into the control, but when I hit a letter,
> > number or symbol key nothing happens. I have placed a break point in
> > the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> > have even tried calling OnChar from the OnKeyDown, but still nothing
> > happens. Please tell me what I'm doing wrong.

0
11/13/2006 9:30:15 PM
Have you tried this without the TOPMOST style?  That might be causing your 
problems.

Tom

"Cliff" <cliff.newton@gmail.com> wrote in message 
news:1163452290.823810.234720@k70g2000cwa.googlegroups.com...
>
> Ok, I've checked for anything that would override the onChar function.
> There isn't a PreTranslateMessage function in any of the classes (the
> dialog, popup window, or edit control). I've also checked the three
> classes for WindowProcs that may have a handler that would prevent the
> edit from processing the WM_CHAR message. There are a couple of OnKeyUp
> handlers and even a handler in a WindowProc, but even upon removing all
> of those handlers the OnChar still doesn't place any characters in the
> edit control. Like I said earlier the OnKeyDown is getting called and I
> call OnChar from my overridden onKeyDown. The only thing that I can
> come up with is that either my edit has a style set wrong, or for some
> reason, the OnChar never interprets the character as a non-system
> character.
> Here is my code for creating the edit control.
>
> m_Edit.CreateEx (WS_EX_CLIENTEDGE | WS_EX_TOPMOST, _T("EDIT"), "",
> ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD | WS_VISIBLE, Rect, this, 8000);
>
> Thanks for any help :)
>
>
> On Nov 13, 11:51 am, "Ajay Kalra" <ajayka...@yahoo.com> wrote:
>> Cliff wrote:
>> > Here is the scenario. I have a dialog which owns a popup window which
>> > owns a cedit control. When I set the focus to the edit control the
>> > caret blinks in the control and I can use the following keys: Insert,
>> > delete, home, end, page up, page down, and the arrow keys. I can't type
>> > any character into the control. I can highlight text and delete it, I
>> > can right click and paste into the control, but when I hit a letter,
>> > number or symbol key nothing happens. I have placed a break point in
>> > the control's OnKeyUp and OnKeyDown functions and the points are hit. I
>> > have even tried calling OnChar from the OnKeyDown, but still nothing
>> > happens. Please tell me what I'm doing wrong.See if it has a 
>> > PreTranslateMessage which is precluding these chars to
>> get to it. There has to be something there which is doing this. It does
>> appear that your control is enabled and its not readonly.
>>
>> ---
>> Ajay
> 


0
tserface (3861)
11/13/2006 9:47:20 PM
Maybe you have competing "Topmost" windows or perhaps you are not notifying 
the parent from the control??? Difficult to say without seeing more code.

Tom

"Cliff" <cliff.newton@gmail.com> wrote in message 
news:1163453415.736647.34480@e3g2000cwe.googlegroups.com...
> Yes, this is a class derived from CEdit, and I have tried the base
> CEdit and it still didn't work. In my hasty posting I forgot to mention
> that the popup window is a class derived from the CTreeCtrl. My derived
> tree is a tree with checkboxes beside each item (not actual check boxes
> just images). The user can check or uncheck each of these boxes. This
> control works fine, but I need to add the ability to allow the user to
> add more items to the check list. I wanted to just use the edit labels
> style of the tree to accomplish this, but I only wanted the user to be
> able to edit one label in particular so I dropped the edit labels idea.
> Now I am taking the course of loading the tree and having one node at
> the top that the user can edit. The user can double click this item and
> my derived edit control will show up. The edit control will
> auto-suggest items that are already in the list below (just in case the
> user overlooks an item). Upon pressing enter in the edit control the
> tree will do one of two things. 1) If the item that was typed in is
> already in the list then the tree will check that item and hide the
> edit control or 2) add the new item and check it.
>
> Whew, with that being said I can tell you this. I tried the edit labels
> style just for the heck of it and even then I couldn't enter any
> characters into the edit that shows up by default. (The edit for the
> CTreeCtrl that is).
>
> Ok, I know that was a lot of info left out on the first post, but I'm
> at work and well time is always short.
>
> Thanks ahead of time for any help.
>
> On Nov 13, 3:03 pm, "Tom Serface" <tserf...@msn.com> wrote:
>> You mentioned that this is a CEdit control, but that you are checking the
>> function for it.  Did you derive your own control froM CEdit?  If so you 
>> may
>> want to try it with the standard control to see if that works OK and that
>> would point to the new control as the problem.  Also, are you using the
>> control anywhere else successfully?
>>
>> Tom
>>
>> "Cliff" <cliff.new...@gmail.com> wrote in 
>> messagenews:1163439048.142829.106370@b28g2000cwb.googlegroups.com...
>>
>> > Here is the scenario. I have a dialog which owns a popup window which
>> > owns a cedit control. When I set the focus to the edit control the
>> > caret blinks in the control and I can use the following keys: Insert,
>> > delete, home, end, page up, page down, and the arrow keys. I can't type
>> > any character into the control. I can highlight text and delete it, I
>> > can right click and paste into the control, but when I hit a letter,
>> > number or symbol key nothing happens. I have placed a break point in
>> > the control's OnKeyUp and OnKeyDown functions and the points are hit. I
>> > have even tried calling OnChar from the OnKeyDown, but still nothing
>> > happens. Please tell me what I'm doing wrong.
> 


0
tserface (3861)
11/13/2006 9:50:43 PM
Is it possible you have inadvertently set the CEdit NUMERIC property and you 
are trying
to type text?

"Cliff" <cliff.newton@gmail.com> wrote in message 
news:1163439048.142829.106370@b28g2000cwb.googlegroups.com...
> Here is the scenario. I have a dialog which owns a popup window which
> owns a cedit control. When I set the focus to the edit control the
> caret blinks in the control and I can use the following keys: Insert,
> delete, home, end, page up, page down, and the arrow keys. I can't type
> any character into the control. I can highlight text and delete it, I
> can right click and paste into the control, but when I hit a letter,
> number or symbol key nothing happens. I have placed a break point in
> the control's OnKeyUp and OnKeyDown functions and the points are hit. I
> have even tried calling OnChar from the OnKeyDown, but still nothing
> happens. Please tell me what I'm doing wrong.
> 


0
12/22/2006 12:50:07 AM
Reply:

Similar Artilces: