SDI ,Terrible.
-
I think I'll end up my entire life trying to make a nodepad application. The wizard generated code & functionalities are totally misleading. wtf ::mad: Today should be my last attempt for this doc/view bullshit. Somebody please help. Let me explain what are the things I've done. 1. Created a new SDI application. 2. Derived the view from
CEditView
. Found & replaced allCView
with CEditView. 3. In the document class, added aCString
memberm_csText
also a getter method to get this string. 4. Modified CMyDocument::Serialize() as ,void CSDITest4Doc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar.Write(m_csText,m_csText.GetLength());
//AfxMessageBox(L"\nHi writing");
// TODO: add storing code here
}
else
{
ar.Read(...read into m_csText...);
AfxMessageBox(m_csText);
UpdateAllViews(0);
}
}5. In the View, added this code for OnUpdate:
void CSDITest4View::OnUpdate(CEditView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/)
{
CSDITest4Doc* pDoc = this->GetDocument();
CString cs = pDoc->getText();
CEdit& cText = GetEditCtrl();
cText.SetWindowTextW(cs);}
As I read in every damn place, they say to "make use" of the standard code, without overriding anything or any modification on save file, open file etc. Now my questions. 1. Why it doesn't show the string in the Edit window?The OnUpdate in view doesn't get called. 2. Why the next time I try to open the same file, it doesn't get into the ::Serialize read function? If I open some other document, it goes there. Otherwise, I need to close the app and open again. Why so? 3. Why it doesn't save anything? 4. From where the ::Serialize function is actually getting called? I want to see the internal MFC code. 5. If I want to debug, set through a "Open file" operation, what should I do? After it shows the File open dialog, it doesn't stop anywhere.
grassrootkit wrote:
I think I'll end up my entire life trying to make a nodepad application.
Strange, as I just did this in all of 10 seconds without changing any of the code.
grassrootkit wrote:
Found & replaced all CView with CEditView.
Why are you doing this manually? AppWizard will do it for you if you select
CEditView
as the base class. BTW, I am using VS6."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
What about this one?[^] lol, but yep I'm losing my patience. As you can see the class names in the code I posted have "4" on them. that's the 4th time I'm creating an application from scratch. For some time I couldn't figure out that it's behaving different when you open the recent file. I thought I messed up the code while trying something. And so recreated again & when I found it, I really felt terrible. Another thing, why the bloody wizard doesn't ask me if I'm willing to derive the view from CEdit, or CForm or something? It looks nasty to find all occurrence of CView with CEditView. Or I'm not using a simpler way that's already there? Also, the reference in the books irritate me like anything. In the books I referred nobody has tried to explain a sample. In Tom Archer's VC++ book, he has, but not following what's suggested in other place. Just a little challenge for you. Try to spot a downloadable good sample SDI application. I hope you win. After digging deep into google, I manged to get This one[^] But it has got some strange language inbetween.
grassrootkit wrote:
Another thing, why the bloody wizard doesn't ask me if I'm willing to derive the view from CEdit, or CForm or something?
It does.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
grassrootkit wrote:
I think I'll end up my entire life trying to make a nodepad application.
Strange, as I just did this in all of 10 seconds without changing any of the code.
grassrootkit wrote:
Found & replaced all CView with CEditView.
Why are you doing this manually? AppWizard will do it for you if you select
CEditView
as the base class. BTW, I am using VS6."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Thanks for your encouragement. Here goes Sample-Application-5. I'm going out for a while now. Will update you with my new sample. Thanks.
-
grassrootkit wrote:
I think I'll end up my entire life trying to make a nodepad application.
Strange, as I just did this in all of 10 seconds without changing any of the code.
grassrootkit wrote:
Found & replaced all CView with CEditView.
Why are you doing this manually? AppWizard will do it for you if you select
CEditView
as the base class. BTW, I am using VS6."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Also, please try to answer me even if the topic goes off the screen. I find people, who really helped, not replying me when the thread goes of the visual range. I hope you'd help me. I wish I don't create any new thread on this topic again. Thanks.
-
Also, please try to answer me even if the topic goes off the screen. I find people, who really helped, not replying me when the thread goes of the visual range. I hope you'd help me. I wish I don't create any new thread on this topic again. Thanks.
grassrootkit wrote:
Also, please try to answer me even if the topic goes off the screen. I find people, who really helped, not replying me when the thread goes of the visual range.
As long as you reply to me and not someone else in the thread, that's usually the case. There are occasions where I may go back and revisit a thread to see how it turned out, but those are the exception.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
What about this one?[^] lol, but yep I'm losing my patience. As you can see the class names in the code I posted have "4" on them. that's the 4th time I'm creating an application from scratch. For some time I couldn't figure out that it's behaving different when you open the recent file. I thought I messed up the code while trying something. And so recreated again & when I found it, I really felt terrible. Another thing, why the bloody wizard doesn't ask me if I'm willing to derive the view from CEdit, or CForm or something? It looks nasty to find all occurrence of CView with CEditView. Or I'm not using a simpler way that's already there? Also, the reference in the books irritate me like anything. In the books I referred nobody has tried to explain a sample. In Tom Archer's VC++ book, he has, but not following what's suggested in other place. Just a little challenge for you. Try to spot a downloadable good sample SDI application. I hope you win. After digging deep into google, I manged to get This one[^] But it has got some strange language inbetween.
grassrootkit wrote:
Just a little challenge for you. Try to spot a downloadable good sample SDI application.
You have not posted which version of Visual Studio you are using but the ones I have install sample applications on my hard drive. In the new versions like VS2008 they are all located in one zip file. For C++ applications there are a large number of samples. It's hard to believe at least one of them isn't an SDI. Changing subjects. There are several Windows C++ Frameworks. I imagine they would all be somewhat equally difficult to understand for someone that might not have a working grasp of C++ language, Design Patterns and the Windows SDK. I don't know what your background is but if you are a beginner perhaps this subject is somewhat beyond your current capabilities.
-
grassrootkit wrote:
Also, please try to answer me even if the topic goes off the screen. I find people, who really helped, not replying me when the thread goes of the visual range.
As long as you reply to me and not someone else in the thread, that's usually the case. There are occasions where I may go back and revisit a thread to see how it turned out, but those are the exception.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Can't believe it's creating a notepad app by default. I had wasted a lot of time trying to do it manually. Thanks David. I'd compare the one I changed manually & the wizard generated. The main difference I see with a glimpse is that the wizard generated app calls the base CEditViews ::Serialize() method.
-
grassrootkit wrote:
Just a little challenge for you. Try to spot a downloadable good sample SDI application.
You have not posted which version of Visual Studio you are using but the ones I have install sample applications on my hard drive. In the new versions like VS2008 they are all located in one zip file. For C++ applications there are a large number of samples. It's hard to believe at least one of them isn't an SDI. Changing subjects. There are several Windows C++ Frameworks. I imagine they would all be somewhat equally difficult to understand for someone that might not have a working grasp of C++ language, Design Patterns and the Windows SDK. I don't know what your background is but if you are a beginner perhaps this subject is somewhat beyond your current capabilities.
Hi led, I use VS2005 but I'd have accepted a sample from any version. btw, I sorted out the problem. Please Check my reply to David Crow[^]. If you have any sample applications on SDI, (it may be a complex one), you may send one to grassrootkit_at_g.m.a.i.l. I'm new only to UI applications.. I've been around C++ for quite some time so shouldn't be a problem. Thanks for the responses.
-
grassrootkit wrote:
Also, please try to answer me even if the topic goes off the screen. I find people, who really helped, not replying me when the thread goes of the visual range.
As long as you reply to me and not someone else in the thread, that's usually the case. There are occasions where I may go back and revisit a thread to see how it turned out, but those are the exception.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Still I got a question, When you open a new file using the File->Open menu, where's the event handled? I mean I would like to see the place where it creates the CFileDialog & does a DoModal(). Where do I put a break point?
-
Still I got a question, When you open a new file using the File->Open menu, where's the event handled? I mean I would like to see the place where it creates the CFileDialog & does a DoModal(). Where do I put a break point?
grassrootkit wrote:
When you open a new file using the File->Open menu, where's the event handled? I mean I would like to see the place where it creates the CFileDialog & does a DoModal().
That happens deep within the bowels of MFC, not at your application level.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons