views:

485

answers:

1

I'm new to MFC and is a bit confused with the new features of "MFC feature pack." Through the wizard I now have an application that looks like an IDE - has a dockable file explorer on the left side and a dockable properties window on the right side. I'm able to get the selected items on the file explorer window through ON_WM_LBUTTONDBLCLK and GetItemText().

Question: Properties window should be "updated" after clicking an item in the file explorer window. Ex. I click an item "button" in the tree control, properties window should show "image", "font", and "color" How can I do that? How do you update the contents of the propertygridCtrl?

A: 

To fill the property grid, look at the wizard-generated content. You'd set up a handler for the 'item button' clicked event, clear the grid content, fill it again. Seems an obvious answer so maybe I misunderstood the question.

Roel
Well that's exactly the logic behind it. I'm able to clear and fill the grid content through the void CPropertiesWnd::OnProperties1() which is called on the message map as ON_COMMAND(ID_PROPERTIES1, OnProperties1). Meaning I would want to invoke OnProperties1() in class CViewTree after clicking on a tree item. How do you invoke afx_msg void OnProperties1()?
Owen
Uh, by calling it like all other methods ? It's just a function like all others, you can call it manually even though it's also called from a message handler.
Roel
invoke afx_msg like a function? hmmm... it doesn't work that way though if you're invoking it from another class. You'll definitely get an error...
Owen
Please state exactly what error you get. Functions declared with afx_msg before them *are* normal functions, you don't call them 'like a function' - they *are* functions. afx_msg doesn't even *do* anything in recent versions of MFC (which you must be using, as you're using the Feature Pack). afx_msg is an empty #define that is 'removed' by the preprocessor. As long as your function is public, you can call it from anywhere (you have to call it with the correct arguments obviously, but message handlers like yours don't take arguments).
Roel