From A FrameWindow
-
How do you route message to a view? I have a CFormView. I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level. For example, I want to handle Window-maximize event from my CFormView. Or if there's a way I can route the message from CFrameWnd to CFormView, it'll be great. Any idea?
-
How do you route message to a view? I have a CFormView. I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level. For example, I want to handle Window-maximize event from my CFormView. Or if there's a way I can route the message from CFrameWnd to CFormView, it'll be great. Any idea?
grassrootkit wrote:
I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level
Only if you have relevant handlers in your frame? I have a vanilla SDI app. I've just added a handler for ID_FILE_OPEN to the view class. It caught the relevant message. For the maximize event, you will have to explicitly route the message. Add the following handler to your frame class and your view should get visibility of maximize events.
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
GetActiveView()->SendMessage(WM_SYSCOMMAND, nID, lParam);CFrameWndEx::OnSysCommand(nID, lParam);
}Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
grassrootkit wrote:
I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level
Only if you have relevant handlers in your frame? I have a vanilla SDI app. I've just added a handler for ID_FILE_OPEN to the view class. It caught the relevant message. For the maximize event, you will have to explicitly route the message. Add the following handler to your frame class and your view should get visibility of maximize events.
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
GetActiveView()->SendMessage(WM_SYSCOMMAND, nID, lParam);CFrameWndEx::OnSysCommand(nID, lParam);
}Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
charm!
-
grassrootkit wrote:
I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level
Only if you have relevant handlers in your frame? I have a vanilla SDI app. I've just added a handler for ID_FILE_OPEN to the view class. It caught the relevant message. For the maximize event, you will have to explicitly route the message. Add the following handler to your frame class and your view should get visibility of maximize events.
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
GetActiveView()->SendMessage(WM_SYSCOMMAND, nID, lParam);CFrameWndEx::OnSysCommand(nID, lParam);
}Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Also Stuart, how do we access the Document from a Dialog that I added through "insert new dialog" in resource option?
-
Also Stuart, how do we access the Document from a Dialog that I added through "insert new dialog" in resource option?
Well, you would need to tell the dialog about the document. You could add a
CDocument*
member variable to the dialog and set it before you callDoModal
. Alternatively (and I prefer this one), just pass the relevant attributes of the document to the dialog, so the dialog doesn't need to know about the document - letting the dialog have visibility of the document class upsets my aesthetic sense.Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p