Accessing Protected Functions
-
The following code is from an artical on "Catching the 'Enter' Key in windows and controls" by Randy More. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible. What would it take to make this function accessible? Bob Broadway bob.broadway@att.net
-
The following code is from an artical on "Catching the 'Enter' Key in windows and controls" by Randy More. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible. What would it take to make this function accessible? Bob Broadway bob.broadway@att.net
well, look for the header file and move the method to the public part. Probably you have to go up the whole 'pedigree'. Derive a class from that class you want the function and in that class you have access to the protected function. First method is to handle with care, second method sometimes is just kind of overkill. Regards G.Steudtel
-
The following code is from an artical on "Catching the 'Enter' Key in windows and controls" by Randy More. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible. What would it take to make this function accessible? Bob Broadway bob.broadway@att.net
Does SMUPPGrid class inherit from CListCtrl? The code you've shown seems correct, providing SMUPPGrid inherits CListCtrl. Michael 'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space