Curious CFormView behavior 
Author Message
 Curious CFormView behavior

I ran into behavior that I consider unexpected when building an SDI
application using CFormView as the base class for the view (Visual C++ 6.0).
My CFormView derivative contains four controls (two edit boxes and two
buttons).  At the start of the application all controls are disabled,
because even in the case of a File | New I need to go through some user
dialog before enabling them.  Now the odd thing is that the Alt key
combinations don't select items from the menu as long as the controls are
disabled.  However, the F10 key works.  I would expect the WM_SYSCHAR
messages to be directed to the frame window, and hence the menu, when there
are no controls in the dialog to take the keyboard focus.  But apparently
that isn't happening.

I turned on Spy++ to see if I could spot where the messages were going.
Apparently they are being directed to the dialog window encapsulated in the
CFormView.  Since the messages aren't redirected to any other window, I
assume the dialog is getting the WM_SYSCHAR messages and eating them.  The
funny thing is that it apparently processes F10 properly, so it's only half
"wrong."

Anybody else seen this?  Is this considered an MFC bug?  Any good ideas for
a workaround?

Thanks!

Bill



Fri, 04 Mar 2005 03:53:04 GMT  
 Curious CFormView behavior
Hi Bill,

You can try the code below in CDerivedView::PreTranslateWindow:

if (pMsg->message == WM_SYSCHAR)
{
        DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
        return TRUE;

Quote:
}

..

You can also return FALSE directly and the framework will continue the
message routine.

I hope this helps.

Best Regards,
Leo Chen

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

| Newsgroups: microsoft.public.vc.language
| Subject: Curious CFormView behavior
| Date: Sun, 15 Sep 2002 14:53:04 -0500
| Organization: Posted via Supernews, http://www.supernews.com

| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

| Lines: 27
| Path:
cpmsftngxa08!cppssbbsa01.microsoft.com!news-out.cwix.com!newsfeed.cwix.com!n
ews.maxwell.syr.edu!logbridge.uoregon.edu!sn-xit-03!sn-xit-01!sn-post-01!sup
ernews.com!corp.supernews.com!not-for-mail
| Xref: cpmsftngxa08 microsoft.public.vc.language:171159
| X-Tomcat-NG: microsoft.public.vc.language
|
| I ran into behavior that I consider unexpected when building an SDI
| application using CFormView as the base class for the view (Visual C++
6.0).
| My CFormView derivative contains four controls (two edit boxes and two
| buttons).  At the start of the application all controls are disabled,
| because even in the case of a File | New I need to go through some user
| dialog before enabling them.  Now the odd thing is that the Alt key
| combinations don't select items from the menu as long as the controls are
| disabled.  However, the F10 key works.  I would expect the WM_SYSCHAR
| messages to be directed to the frame window, and hence the menu, when
there
| are no controls in the dialog to take the keyboard focus.  But apparently
| that isn't happening.
|
| I turned on Spy++ to see if I could spot where the messages were going.
| Apparently they are being directed to the dialog window encapsulated in
the
| CFormView.  Since the messages aren't redirected to any other window, I
| assume the dialog is getting the WM_SYSCHAR messages and eating them.  The
| funny thing is that it apparently processes F10 properly, so it's only
half
| "wrong."
|
| Anybody else seen this?  Is this considered an MFC bug?  Any good ideas
for
| a workaround?
|
| Thanks!
|
| Bill
|
|
|



Sat, 05 Mar 2005 15:51:15 GMT  
 Curious CFormView behavior
Thanks!  That did the job.  I appreciate the help.

(For anyone else looking at this:  it's PreTranslateMessage, not
PreTranslateWindow.  But I knew what you meant.)

Bill



Quote:
> Hi Bill,

> You can try the code below in CDerivedView::PreTranslateWindow:

> if (pMsg->message == WM_SYSCHAR)
> {
> DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
> return TRUE;
> }
> ..

> You can also return FALSE directly and the framework will continue the
> message routine.

> I hope this helps.

> Best Regards,
> Leo Chen

> This posting is provided "AS IS" with no warranties, and confers no
rights.

> --------------------

> | Newsgroups: microsoft.public.vc.language
> | Subject: Curious CFormView behavior
> | Date: Sun, 15 Sep 2002 14:53:04 -0500
> | Organization: Posted via Supernews, http://www.supernews.com

> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

> | Lines: 27
> | Path:

cpmsftngxa08!cppssbbsa01.microsoft.com!news-out.cwix.com!newsfeed.cwix.com!n
ews.maxwell.syr.edu!logbridge.uoregon.edu!sn-xit-03!sn-xit-01!sn-post-01!sup

- Show quoted text -

Quote:
> ernews.com!corp.supernews.com!not-for-mail
> | Xref: cpmsftngxa08 microsoft.public.vc.language:171159
> | X-Tomcat-NG: microsoft.public.vc.language
> |
> | I ran into behavior that I consider unexpected when building an SDI
> | application using CFormView as the base class for the view (Visual C++
> 6.0).
> | My CFormView derivative contains four controls (two edit boxes and two
> | buttons).  At the start of the application all controls are disabled,
> | because even in the case of a File | New I need to go through some user
> | dialog before enabling them.  Now the odd thing is that the Alt key
> | combinations don't select items from the menu as long as the controls
are
> | disabled.  However, the F10 key works.  I would expect the WM_SYSCHAR
> | messages to be directed to the frame window, and hence the menu, when
> there
> | are no controls in the dialog to take the keyboard focus.  But
apparently
> | that isn't happening.
> |
> | I turned on Spy++ to see if I could spot where the messages were going.
> | Apparently they are being directed to the dialog window encapsulated in
> the
> | CFormView.  Since the messages aren't redirected to any other window, I
> | assume the dialog is getting the WM_SYSCHAR messages and eating them.
The
> | funny thing is that it apparently processes F10 properly, so it's only
> half
> | "wrong."
> |
> | Anybody else seen this?  Is this considered an MFC bug?  Any good ideas
> for
> | a workaround?
> |
> | Thanks!
> |
> | Bill
> |
> |
> |



Sun, 06 Mar 2005 10:27:57 GMT  
 Curious CFormView behavior
Thanks for telling me the mistake. :-)

Best Regards,
Leo Chen

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

| Newsgroups: microsoft.public.vc.language
| Subject: Re: Curious CFormView behavior
| Date: Tue, 17 Sep 2002 21:27:57 -0500
| Organization: Posted via Supernews, http://www.supernews.com



| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

| Lines: 93
| Path:
cpmsftngxa08!cpmsftngxa06!tkmsftngp01!newsfeed00.sul.t-online.de!t-online.de
!nntp-relay.ihug.net!ihug.co.nz!logbridge.uoregon.edu!sn-xit-03!sn-xit-01!sn
-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
| Xref: cpmsftngxa08 microsoft.public.vc.language:171361
| X-Tomcat-NG: microsoft.public.vc.language
|
| Thanks!  That did the job.  I appreciate the help.
|
| (For anyone else looking at this:  it's PreTranslateMessage, not
| PreTranslateWindow.  But I knew what you meant.)
|
| Bill
|


| > Hi Bill,
| >
| > You can try the code below in CDerivedView::PreTranslateWindow:
| >
| > if (pMsg->message == WM_SYSCHAR)
| > {
| > DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
| > return TRUE;
| > }
| > ..
| >
| > You can also return FALSE directly and the framework will continue the
| > message routine.
| >
| > I hope this helps.
| >
| > Best Regards,
| > Leo Chen
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| >
| > --------------------

| > | Newsgroups: microsoft.public.vc.language
| > | Subject: Curious CFormView behavior
| > | Date: Sun, 15 Sep 2002 14:53:04 -0500
| > | Organization: Posted via Supernews, http://www.supernews.com

| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

| > | Lines: 27
| > | Path:
| >
|
cpmsftngxa08!cppssbbsa01.microsoft.com!news-out.cwix.com!newsfeed.cwix.com!n
| >
|
ews.maxwell.syr.edu!logbridge.uoregon.edu!sn-xit-03!sn-xit-01!sn-post-01!sup
| > ernews.com!corp.supernews.com!not-for-mail
| > | Xref: cpmsftngxa08 microsoft.public.vc.language:171159
| > | X-Tomcat-NG: microsoft.public.vc.language
| > |
| > | I ran into behavior that I consider unexpected when building an SDI
| > | application using CFormView as the base class for the view (Visual C++
| > 6.0).
| > | My CFormView derivative contains four controls (two edit boxes and two
| > | buttons).  At the start of the application all controls are disabled,
| > | because even in the case of a File | New I need to go through some
user
| > | dialog before enabling them.  Now the odd thing is that the Alt key
| > | combinations don't select items from the menu as long as the controls
| are
| > | disabled.  However, the F10 key works.  I would expect the WM_SYSCHAR
| > | messages to be directed to the frame window, and hence the menu, when
| > there
| > | are no controls in the dialog to take the keyboard focus.  But
| apparently
| > | that isn't happening.
| > |
| > | I turned on Spy++ to see if I could spot where the messages were
going.
| > | Apparently they are being directed to the dialog window encapsulated
in
| > the
| > | CFormView.  Since the messages aren't redirected to any other window,
I
| > | assume the dialog is getting the WM_SYSCHAR messages and eating them.
| The
| > | funny thing is that it apparently processes F10 properly, so it's only
| > half
| > | "wrong."
| > |
| > | Anybody else seen this?  Is this considered an MFC bug?  Any good
ideas
| > for
| > | a workaround?
| > |
| > | Thanks!
| > |
| > | Bill
| > |
| > |
| > |
| >
|
|
|



Mon, 07 Mar 2005 14:21:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Curious behavior, debug vs. release mode

2. CFormView within a CFormView error

3. CFormView on CFormView?

4. Closing a CFormView window from another CFormView window

5. Problems with CFormView inside CFormView (mnemonic keys)

6. Appwizard CFormView Assertion Error (also no or blank dialog (CFormView)) VS6.0 and VSNETBETA2

7. How to insert a CFormView in a CFormView?

8. curious: opinion on your choice: dialog based, or single document CFormView?

9. Curious DataBinding issue on Insert

10. Just being curious.

11. Curious pi program

12. Curious?!

 

 
Powered by phpBB® Forum Software