Solved

Showing a CRecordView Dialog

Posted on 1998-05-18
5
361 Views
Last Modified: 2008-02-01
Hello,
I am trying to show a Dialog constructed in the AppWizard with the base-class CRecordView. Now when I try to show the dialog, I get an assertion failure. This is done in the Dialog based application.
The way I have done this is =

CMyRecordView cView;

cView.ShowWindow(SW_SHOW);
cView.Update();

Shouldn't this be enough for showing my dialog?
Is it possible to display a CRecordView in a dialog based application?
Please help me!!!
0
Comment
Question by:Imran020598
  • 3
  • 2
5 Comments
 

Expert Comment

by:matzon
ID: 1163001
Hi....
Your problem is, that you try to show a window which hasn't yet been created!

You have to instanciate it and then call its create command...
i.e.
//In you Header file
CMyRecordView cView;

//In your cpp file
cView.Create(YOUR_RESOURCE_ID, &TheParent);
//I don't recall whether you need the parent or not... *ponder*

hope this helps...
0
 

Expert Comment

by:matzon
ID: 1163002
... Ofcourse you have to call the ShowWindow() too. :)
0
 

Author Comment

by:Imran020598
ID: 1163003
Hello Matzon,
This did not solve my problem. It seems to me that when the create function is called the assertion error is displayed. From what I know, I don't need to call the create function (although I have tried) because this is called by MFC itself!
From what I have found out, It does not seem to be possible to create a dialogbox in a dialogbased application with the base class as CRecordview.
0
 

Accepted Solution

by:
matzon earned 20 total points
ID: 1163004
achh...
My fault.... You can't create a dialog that uses a CRecordView, since a View is only used in a SDI or MDI application!

So what you want to do, is to start a new application workspace and choose either SDI or MDI instead of dialog. Include header files (or choose to have with/without file support).
At the last page of the wizard, change your view to CRecordView.
That Should do it...
If you do want to show database data in a dialog you have to manually insert the data from the database in some of the editfields(or whatever) that you have create. If this doesn't work Could you then supply a more specific question, or mail me the sample app and database then i'll have a looksee
btw: are you using ODBC?
0
 

Author Comment

by:Imran020598
ID: 1163005
Hello Matzon,
Thnx for your help, but actually I knew that a View class can only be used in a SDI or MDI application. But I was hoping for some dirty work arround so that it could be used in a dialog-based application. Anyway thnx for the effort and your time!
Regards
Imran
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now