Well, lucky me to find the solution... `-)
OnEndEdit().
//new line will come here...
I know it is not such an elegant solution, but at least it works.
On Monday, June 21, 2010 4:43 PM Joseph M. Newcomer wrote:
See below...
****
You're right not to like this code. It is horrible, and essentially a nightmare. The
CORRECT approach is to SendMessage to the main frame a user-defined message, e.g.,
CString propertyname;
CString newvalue;
...fetch these from the property pane...
AfxGetMainWnd()->SendMessage(UWM_PROPERTY_CHANGED,
(LPARAM)&propertyname,
(WPARAM)&newvalue);
and stop right there.
What I would probably do in the mainframe is send the message to the current view, which
would call a method of the CDocument-class,
void CMyDocument::SetProp(const CString & propname, const CString & value);
and let it worry about what gets set.
The downside is that every view has to have a handler for this message, since you do not
know which view might be active.
LRESULT OnPropertyChange(WPARAM wParam, LPARAM lParam)
{
CString * prop = (CString *)wParam;
CString * val = (CString *)lParam;
GetDocument()->SetProp(*prop, *val);
return 0;
}
Always maintain abstraction. When you find yourself doing horrible casts and having to
include header files that you should not need, you have a bad architecture.
joe
****
****
I do not have a good answer for that problem. However, there are some fascinating problems
about how <enter> is handled when controls are embedded in MFC views; the classic one is
how to handle <enter> when editing a tree-control item (the code, however, is massively
buggy; I discuss this in my MSDN Errors and Omissions articles)
joe
****
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
On Monday, June 21, 2010 4:45 PM Joseph M. Newcomer wrote:
See below...
****
I would have thought this was what you were *starting from*.
****
****
As I indicated in an earilier reply, there is nothing justifiable about any part of the
above code. You should not be casting the AfxGetMainWnd to anything, and the very
presence of CMyView* indicates a deep design error that should not exist.
joe
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Submitted via EggHeadCafe - Software Developer Portal of Choice
Changing WCF Service Implementation at Runtime
http://www.eggheadcafe.com/tutorials/aspnet/d9263dcc-f7ed-42f3-bc96-321461be3306/changing-wcf-service-implementation-at-runtime.aspx