CFromView
-
Hi, I created the CFromView dynamically, Form is having CListCtrl where should set the style for CListCtrl? the below code is giving error as m_ListDriveis is NULL .
bool CRecoverDriveDlg::CreateView(UINT Style, CRect rect,CWnd *Parent)
{
Create(NULL,NULL,Style,rect,Parent,0x10,NULL);m\_ListDrive.SetExtendedStyle(LVS\_EX\_FULLROWSELECT);//error return 1;
}
-
Hi, I created the CFromView dynamically, Form is having CListCtrl where should set the style for CListCtrl? the below code is giving error as m_ListDriveis is NULL .
bool CRecoverDriveDlg::CreateView(UINT Style, CRect rect,CWnd *Parent)
{
Create(NULL,NULL,Style,rect,Parent,0x10,NULL);m\_ListDrive.SetExtendedStyle(LVS\_EX\_FULLROWSELECT);//error return 1;
}
What is
m_ListDrive
supposed to be and where is it initialised?Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Hi, I created the CFromView dynamically, Form is having CListCtrl where should set the style for CListCtrl? the below code is giving error as m_ListDriveis is NULL .
bool CRecoverDriveDlg::CreateView(UINT Style, CRect rect,CWnd *Parent)
{
Create(NULL,NULL,Style,rect,Parent,0x10,NULL);m\_ListDrive.SetExtendedStyle(LVS\_EX\_FULLROWSELECT);//error return 1;
}
I'm guessing what you mean is
m_ListDrivis.m_hwnd
is null. The variable somehow needs to be attached to the dialog control. This can be done with Dynamic Data eXchange (DDX) or the SubclassDlgItem[^] function, which must be called beforem_ListDrive.SetExtendedStyle(LVS_EX_FULLROWSELECT);
. You could also make it into a pointer in the class definition, and then usem_ListDrive = (CListCtrl *)GetDlgItem(IDC_MY_LIST); //CListCtrl is whatever control type it is, IDC_MY_LIST is the control ID set in the properties window in the dialog editor.
m_ListDrive->SetExtendedStyle(LVS_EX_FULLROWSELECT); -
Hi, I created the CFromView dynamically, Form is having CListCtrl where should set the style for CListCtrl? the below code is giving error as m_ListDriveis is NULL .
bool CRecoverDriveDlg::CreateView(UINT Style, CRect rect,CWnd *Parent)
{
Create(NULL,NULL,Style,rect,Parent,0x10,NULL);m\_ListDrive.SetExtendedStyle(LVS\_EX\_FULLROWSELECT);//error return 1;
}
Why shouldn't it be
NULL
? I mean, you didn't show us the code initializing it.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I'm guessing what you mean is
m_ListDrivis.m_hwnd
is null. The variable somehow needs to be attached to the dialog control. This can be done with Dynamic Data eXchange (DDX) or the SubclassDlgItem[^] function, which must be called beforem_ListDrive.SetExtendedStyle(LVS_EX_FULLROWSELECT);
. You could also make it into a pointer in the class definition, and then usem_ListDrive = (CListCtrl *)GetDlgItem(IDC_MY_LIST); //CListCtrl is whatever control type it is, IDC_MY_LIST is the control ID set in the properties window in the dialog editor.
m_ListDrive->SetExtendedStyle(LVS_EX_FULLROWSELECT);Where did you get all this about a dialog? The OP's question is about creating a window.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Where did you get all this about a dialog? The OP's question is about creating a window.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
I have not used MFC for about a year now, so my memory could be a bit flaky, but: "These controls are laid out based on a dialog-template resource." - CFormView Class[^]. The form view is a pretty way of embedding a dialog into a MFC view. All of the controls on it have a dialog ID associated with them.
-
I have not used MFC for about a year now, so my memory could be a bit flaky, but: "These controls are laid out based on a dialog-template resource." - CFormView Class[^]. The form view is a pretty way of embedding a dialog into a MFC view. All of the controls on it have a dialog ID associated with them.
That may well be true but it does not seem to be the way OP is implementing it. I'm ready to stand corrected, however.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
That may well be true but it does not seem to be the way OP is implementing it. I'm ready to stand corrected, however.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
I could be completely wrong on this, but to me, it appears that he has defined a variable, something like
CListCtrl m_ListDrive
in the CRecoverDriveDlg class. He is expecting this variable to automatically attach to some list control he has in the dialog template (I dont see a call tom_ListDrive.Create()
). My suggestion was to manually attachm_ListDrive
to this control somehow. It is possible that he has calledm_ListDrive.Create()
elsewhere in his code and simply hasn't shown it and hence I am completely wrong. Since the original issue is m_ListDrive is NULL, then this call has failed, and that code would be relevant to helping him find a solution. -
I could be completely wrong on this, but to me, it appears that he has defined a variable, something like
CListCtrl m_ListDrive
in the CRecoverDriveDlg class. He is expecting this variable to automatically attach to some list control he has in the dialog template (I dont see a call tom_ListDrive.Create()
). My suggestion was to manually attachm_ListDrive
to this control somehow. It is possible that he has calledm_ListDrive.Create()
elsewhere in his code and simply hasn't shown it and hence I am completely wrong. Since the original issue is m_ListDrive is NULL, then this call has failed, and that code would be relevant to helping him find a solution.I agree, which is why my question to him was "what is this variable and where is it initialised?". We will see; or not!
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman