OnCmdMsg
-
Hi! I've been playing around with custom command routing a bit, and I've noticed that if you route a command message to a custom object,
object.OnCmdMsg(...)
, and the function returns TRUE(saying it has handled the message and called the message handler), but I return FALSE instead (saying the message hasn't been handled), the command handler for the custom object is never called (even though it already should've been called(?)). I hope someone can give me an explanation on why the handler isn't being called, and that the description above isn't to messy :) -
Hi! I've been playing around with custom command routing a bit, and I've noticed that if you route a command message to a custom object,
object.OnCmdMsg(...)
, and the function returns TRUE(saying it has handled the message and called the message handler), but I return FALSE instead (saying the message hasn't been handled), the command handler for the custom object is never called (even though it already should've been called(?)). I hope someone can give me an explanation on why the handler isn't being called, and that the description above isn't to messy :)This is the correct behaviour. MFC knows nothing about your custom object, even though you do. MFC checks to see if the current view handles the message. If it doesn't, it sends it to the current document. If the document doesn't handle it, it sends it to the current frame, the main frame (in an MDI application), and finally to the application if necessary. It never looks below the view.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Hi! I've been playing around with custom command routing a bit, and I've noticed that if you route a command message to a custom object,
object.OnCmdMsg(...)
, and the function returns TRUE(saying it has handled the message and called the message handler), but I return FALSE instead (saying the message hasn't been handled), the command handler for the custom object is never called (even though it already should've been called(?)). I hope someone can give me an explanation on why the handler isn't being called, and that the description above isn't to messy :)