Link to home
Start Free TrialLog in
Avatar of irvinm
irvinm

asked on

CFormView, CDialog, and events...

Environment:  VC++ 5.0 and Windows NT 4.0

Hello everyone,

I'm creating a CFormView based MDI application and have created a CDialog based class to handle the processing for the dialog itself.  My question involves the handling of events.

If I add an event handler (for a button on the dialog for example) to the CDialog based class, I don't seem to be able to receive notifications from the button.  However, if I place the event handler in the CFormView based class, I can
receive the event from the button.

Is there any way to have the CDialog based class handle the events without manually passing the events to the class thru the CFormview based class?

Any suggestions would be helpful.

Thanks in advance,
Mike Irvin
M.Irvin@Dialogic.com
Avatar of davmarc
davmarc

Controls included in your CDialog window send notification messages to their parent - the CDialog.

Controls included in your CFormView window send notification messages to their parent - the CFormView.

If you want someone else CDialog to handle CFromView controls notification messages (or vice versa) you must forward the messages manually.

Davide Marcato.
Hi MikeIrvin,
I dont clearly understand your requirement.As far as I understand  ur requirement, I think u may have to pass the messages manually.

Avatar of irvinm

ASKER

I am a little confused over the concept of having a CDialog
class handling the controls in the dialog.

In my application I am trying to separate the CView (CFormView)
from the processing and event handling in the CDialog.  When
I add an event processor in the CDialog to handle the events
from the controls in the dialog, I can not receive events.

However, if I move the event handling to the View class,
everything is fine.  So, from your explaination, events from
the Dialog controls should be routed to the parent (which
makes sense), but since that is the CView, what is the point
of creating a separate class (CDialog) based to handle the
processing when events have to be manually route to this
class.

Doesn't it make sense to place the processing of dialog controls
into a CDialog class for encapsulation purposes.

Thanks for the initial information,
Mike Irvin
ASKER CERTIFIED SOLUTION
Avatar of davmarc
davmarc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of irvinm

ASKER

Thank you for the explaination.