Newbie question RE: MDI SingleDoc/MultipleViews

Apologies in advance for the newbie question - but I warned you in the
subject line.

I'm new to MFC and MDI applications and I'm trying to learn the
underlying principles behind the MDI architecture. As an educational
exercise, I'm writing an MDI application that manages inventory for a
car dealership. I chose MDI over SDI because in the future, I'd like
to manage multiple dealerships within the same application.

Anyway, here's my question. My dealership doc has cars, salesmen,
customers, etc. I have View classes designed for each of these basic
objects in my application, and I can create these views without issue.
However, I'm stuck on creating different views of the same class.  For
example, I have CCarListView meant to display cars.  Currently this
view displays all the cars at the dealership. I'd like different menu
commands to display different car lists - for example, using this
CCarListView, display only the black cars at the dealership, or SUVs,
or hybrids, etc. So what I'm trying to do is reuse the same View class
to display different lists, pulling different data sets from my doc.

So far I've come up with two ways of doing this:

1) Define different CCarListView classes for each data subset - this
design seems broken and I refuse to build my application this way...

2) Add a method to CCarListView to re-populate the data in the
ListView with the subset data. So after I create a new view, call a
method that takes in the actual data items. Maybe I shouldn't be
populating the data in InitialUpdate(). This seems more reasonable,
but I'm not convinced it's the best way.

OT to the question above - what's the Petzold equivalent book for
MFC/MDI?

Thanks in advance.
0
user2084 (3)
11/13/2004 2:20:59 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
304 Views

Similar Articles

[PageSpeed] 34

The Choice of whether or not you want to use SDI or MDI rather depends on 
whether you want to show multiple views (datasets) at the same time. If you 
do then MDI would be the way to go.

> 1) Define different CCarListView classes for each data subset - this
> design seems broken and I refuse to build my application this way...

You most DEFINATELY DO NOT want to do this. Use your CCarListView and 
provide a filter.
If you are using list views in your views, then there is NO reason why you 
can't just use ONE view class, and make it provide the information you need 
with different filters. The best thing to do is to use some sort of database 
behind your application, and use SQL statements to provide the information 
you need to show to your user. You can construct your listview based on the 
SQL Statement and let the database do all the hardwork in providing you with 
the dataset you need.

M

"User 2084" <user2084@hotmail.com> wrote in message 
news:fff4b05c.0411130620.59ced8a1@posting.google.com...
> Apologies in advance for the newbie question - but I warned you in the
> subject line.
>
> I'm new to MFC and MDI applications and I'm trying to learn the
> underlying principles behind the MDI architecture. As an educational
> exercise, I'm writing an MDI application that manages inventory for a
> car dealership. I chose MDI over SDI because in the future, I'd like
> to manage multiple dealerships within the same application.
>
> Anyway, here's my question. My dealership doc has cars, salesmen,
> customers, etc. I have View classes designed for each of these basic
> objects in my application, and I can create these views without issue.
> However, I'm stuck on creating different views of the same class.  For
> example, I have CCarListView meant to display cars.  Currently this
> view displays all the cars at the dealership. I'd like different menu
> commands to display different car lists - for example, using this
> CCarListView, display only the black cars at the dealership, or SUVs,
> or hybrids, etc. So what I'm trying to do is reuse the same View class
> to display different lists, pulling different data sets from my doc.
>
> So far I've come up with two ways of doing this:
>
> 1) Define different CCarListView classes for each data subset - this
> design seems broken and I refuse to build my application this way...
>
> 2) Add a method to CCarListView to re-populate the data in the
> ListView with the subset data. So after I create a new view, call a
> method that takes in the actual data items. Maybe I shouldn't be
> populating the data in InitialUpdate(). This seems more reasonable,
> but I'm not convinced it's the best way.
>
> OT to the question above - what's the Petzold equivalent book for
> MFC/MDI?
>
> Thanks in advance. 


0
11/13/2004 3:51:07 PM
Reply:

Similar Artilces:

Subform Question 07-24-07
I appreciate any help that is available, and I thank you in advance for your attention...as you will be able to tell, im really new at all of this. Alright, I am in the process of making a database from scratch, and I have my tables all set up how I would like them, and i am making forms now for record entry. I have one main table: Company Information (self explanatory, primary key is company name. I know, i know, it should be an ID number) I have a form where users enter information on a company, and can call up basic information on a company. I added a button that, when pressed, calls up...

question/Issue with Cached Exchange Mode and the 'Connected (headers) mode
I am running Outlook 2003 SP1 setup with cached exchange mode and I have the following issue; when I work in connected mode with the download Header option selected, Outlook 2003 downloads completly(header & body) all incoming emails instead of downloading only emails headers I initially thought this was due to Active Sync which was installed on my PC (Win2000 SP4) , so I desinstalled it , reboot but still Outlook keeps on downloading the full emails (header & Body). Any idea why Outlook behaves in such a way and how to correct it? Thank You, Jean ...

Re: Random Weight UPC Code with embedded price.
On Jul 31 2007, 7:58 pm, "Glenn Adams [MVP - Retail Mgmt]" <gl...@nospam.tibercreek.com> wrote: > I replyed to your previous post with instructions, but I think you have > a problem. randomweightupc only supports price up to $99.99. You > need to switch to EAN, which supports up to $999.99 > UPC format: p#####s$$$$c > p = prefix (2) > ##### = 5 digit PLU > s = secondary check digit > $$$$ = 4 digit price > c = check digit > > EAN Format: pp#####$$$$$c > pp = prefix (20 or 02) > ##### = 5 digit PLU > $$$$$ = 5 digit price > c = chec...

*.csv file question
Question : I have *.csv file that contains data I would like to chart using MS Excel . The data in the *.csv file is updated by another window every minute for a period of 7 hours. If I load the *.csv file into Excel my chart will be current for only one minute. Is it possible to reload the same *.csv file one minute later and have an updated chart and will this present a possible conflict with the other window if I load the file at the same time the other window is updating the data ? On Fri, 1 Oct 2004 12:48:21 -0600, "Rob" <rls_jls@worldnet.att.net> wrote: Have a loo...

Excel Formula Question
Hi there. I need to figure out how many items in a column fall between a certain range. I have a list of 354 numbers, and I want to find how many cells contain numbers between 1000 and 10000, and return that number to me. I have explored the help and on-line resources, but cannot find an answer to this. Can anyone help? Thanks Steve Page Hi, Assuming that your list is in Column A: =SUMPRODUCT((A1:A100>1000)*(A1:A100<10000)) Adjust the range according to your data. Hope this helps -- Message posted from http://www.ExcelForum.com That works perfectly. Thanks a million. "...

Graph Question. Values from different pages. Not in same cell ranges.
Hi, I have an excel work book which keeps track of players averages in a dart league. Every week gets a different page. I would like pages for individual players, that will keep track of only 2 columns on a weekly basis, which I will use to make a graph. Because the stats are sorted by high average, the players don't always stay in the same cells. The long way would be for me to reference the necessary cells, week to week. I was wondering if there is a script that can do the following pseudocode. Using C1 in the current individual player's sheet. C1 = Where "Week1.Ce...

RE: in Rules
Hi All, yesterday I discovered the power of rules. I wish to know how to get e-mails from lists to be in the same group. At the moment, I've set rules to place e-mails with certain text, [listsubject], for example in the subject to a certain folder and then I've grouped by subject, which is great, but, the original and the replies a grouped differently, due to the extra, re:, in the subject. Can I filter this to allow the original e-mail and the replies to be grouped together..? Hope this makes sense, cheers. Mark Sargent. ...

Default Drive Question
I have read posts explaining why chdrive is needed to make sure the right drive is the default drive. Thanks, Messrs Peterson and Ogilvy. I have the following two lines of code, but the default drive used by the print statement in this case isn't affected by the chdrive statement. Any idea why? If I do a filesaveas command from file menu and save the file to the c drive then the PDF will go to that drive. chdrive "g" ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _ "Acrobat PDFWriter on G:\Pdf\*.pdf", Collate:=True The drive used for ...

RE: Try on this corrective update
--pdhzsnkp Content-Type: multipart/related; boundary="wsixwemqnumlyt"; type="multipart/alternative" --wsixwemqnumlyt Content-Type: multipart/alternative; boundary="hvuhgxrookotxeva" --hvuhgxrookotxeva Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "September 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three new vulnerabilities. Install now to help...

Silly question...
Why does A.D. say that it's going to delete the associated mailbox when you delete a distribution group? There's no mailbox created is there? And I don't believe it kills all the user mailboxes that were in the distribution group that is being deleted. Thanks, D A distribution group is a mail enabled object hence the reference to mailbox deletion. As you suggest there is no mailbox and it will not delete any mailboxes of users included in the distribution group. Nue "Dan" <Dan@discussions.microsoft.com> wrote in message news:68EB152B-4F73-4B27-89E4-41C37D...

Re: Preventing Appointments being made
Hi New to this group and have read a little but not found what I am looking for. Is it possible within Outlook 2000 to set up a series of day when someone is on holiday so that no appointment can be added by mistake. I know a message can be viewed at the top of the calendar when a series is set as All day and Out of Office but this doesn't seem to prevent an appointment being made by mistake. Further to the above I would need to do the same with bank holidays. Also, is there a way to make the bank holidays stand out in, say, another colour? Any help appreciated. Cheers Go into t...

CRM 3.0
I am trying to use the Cases section of the CRM and have a couple of "how do you do it" questions. In general and prior to using the MSCRM, when our customers call for support our receptionist takes the call and sends out a emal to a distribution list which has all our techs in it which they receive on their BlackBerry's. From there, one of them will take the issue. I'd like to use the same process (or a better one if someone wants to recommend something) for the cases section of the CRM it do the same thing. So, How do other people who use the CRM Case section h...

Update query question 04-26-10
Hello, I would like to update a record by looking at the value from a form combo box column(1). I have tried Forms![Lab Works Manager]![cmbTo].column(1) but it does not work. The bond column(0) has the ID, but in this case I need to use the actual value from column(1) and not column(0). Any idea how? Thank you, Silvio Add a hidden control to your form and set its value to =Forms![Lab Works Manager]![cmbTo].column(1) Then you can reference that hidden control in the query. Your other option is to write a VBA function and pass in the name of the form, the name of the co...

Office 2004 Installation General Question
There is nothing in the Office 2004 package that instructs what to do with the old Office X applications. I was surprised to see that Office 2004 is completely new application installation - and not a modification of base code of the old Office X. What should I do - just delete the old Office X apps? Any danger to this? Thanks Rob In article 5c4a79bf.0405151751.38097dce@posting.google.com, Rotund rob@marqusee.com wrote on 16/5/04 11:51: > There is nothing in the Office 2004 package that instructs what to do > with the old Office X applications. I was surprised to see that > Of...

Exchange 2003 big question!!!
Dear Sir Please see below more details,(We are using special railway line between Head office in Taipei and branch office in Tao-Yuan) Head office in Taipei: aaa.com(Root domain) Dc server * 2(One of it is GC Server), Front-End Exchange 2003 *1, Back-End Exchange 2003 * 2(One is named mail1, another is named mail2 ) Branch office in Tao-Yuan: bbb.aaa.com(sub-domain) Dc Server *1(No GC Server,No Exchange Server) After using ADMT v3 Tool, when I transfer an account from root named aaa.com(ou) to bbb.aaa.com. After I ins...

Question...
I was wondering if anyone knows where I can download Outlook 2002, Outlook 2003, or Outlook XP? Thank You! Matthew They are not available for download. You must purchase them hard copy. And Outlook XP and Outlook 2002 are the same product. -- Patricia Cardoza Outlook MVP Author - Special Edition Using Microsoft Office Outlook 2003 Lead Author - Access 2003 VBA Programmer's Reference Author - Absolute Beginner's Guide to Microsoft OneNote 2003 http://blogs.officezealot.com/cardoza "Matthew Surber" <matthew_surber@earthlink.net> wrote in message news:7I_8d.102...

Inbound connection + form question
Hello, I just set up sharepoint server 2007 sp1 for the first time. It works like a charm internally. I've got a domain name and it is being forwarded to my external IP address which responds ok. However when I try to go to the web address I get a page cannot be displayed. I've got my port 80 being sent to sharepoint servers IP also internally from the router (netgear prosafe). What step am I missing here any ideas? Also I was wondering if there was a way to set up a "form" so to speak where a user could click on something, it would open up say a excel spreadsh...

Another transfer question
Hi, I have read all posts regarding transfers between 2 acounts but I could not find the answer to that question. I download all operations from my bank web site. I have a few accounts. I frequently do money transfers between 2 accounts. I do it online most of the times. Here is the problem description: - I download operations including some transfer from account A to acoount B. - All operations are automatically imported into Money. - I open advanced regsiter for account A and categorize the transfer operation as "Transfer from/to account B". - Still in Money, I open accoun...

Formula Question #24
I am working on a excel sheet that was designed by someone else. One formaula currently pulls all hours charged against a department. I would like it to list only hours charged for the current month. The formaula currently looks like this =SUMIF(Register!X:X,"APPROVED",Register!L:L)+SUMIF(Register!X:X,"PENDING",Register!L:L) I type the date into cell U2 (eg 01/09/05). On the Register sheet column W contains the date the document was approved or pending. I want this formula to only pull the hours corresponding to the month I type in on cell U2. Any assistance is ...

Question of RAID in x64
I've installed win 7 Pro x64 in a computer with RAID-1, two same disks mirroring each other. well I don't want anymore this option, the RAID is done on the RAID connection of MOBO, not in the SATA alone connections and is done via post-BIOS. I've done some trials, I've disconnected the HD from the RAID connection and connected to the pure SATA connections, but OS doesn't start, could be that RAID has not been unsetup. what should I have to do?? 1 - go into RAID configuration during booting and break the RAID if I'd do this do I lost the info in H...

Direct Push configuration, features, and questions
Now that a few devices appear close to releasing the MSFP upgrade to support direct push I am trying to make sure that I have all my "ducks in a row". As I understand it the only configuration I need to do on my Exchange Server is to enable Direct Push over HTTP, and configure whatever Device Security I desire. Can anyone point me to a document that discusses the various security settings. For example, what settings are being refreshed on the device with that option. Is the "Wipe device after failed..." the only way to kill a lost or stolen device? How does the ...

Advanced Find or a View Question
Is there a field to find out the current user logged in from the Accounts itself. The owner is the owner who owns the account. I am trying to find the current user logged in so I can give a filtered view based on it. Thanks Hi: Michael has posted a great example of how this can be done here: http://www.stunnware.com/crm2/topic.aspx?id=AJAX1 -- John. Microsoft Principal Architect This message sent from Windows Vista! <srini.venkatesan@gmail.com> wrote in message news:1161904149.549945.253590@m73g2000cwd.googlegroups.com... > Is there a field to find out the current user logged...

Pivot Table Question
Hi All I originally posted this in microsoft.pulic.excel but was advised to post here as well - so please don't yell at me about posting to multiple groups :) *** is there a way in a pivot table to only use (& therefore group on ) part of a value name ... e.g. if i have Car Number BMW - Blue 100 BMW - Red 20 VOLVO - Blue 50 VOLVO - Red 10 and i want a pivot table to look like this Blue Red Total BMW 100 20 120 VOLVO 50 10 60 150 30 ...

unfamiliar with how Excel handles data
I inherited a work excel spreadsheet from an employee who was fired and has no desire to help the company. My question: There is a table of info, say with: name, address, phone number, fax number, email. If you place the cursor in a box on the spreadsheet (different page) and type a number - say 1 corresponding to line 1 on the table - the info will then populate certain fields on the spreadsheet. Or, if I type "1" I get Joe Smith, 1600 Pennsylvania Ave, phone, fax & email in 5 different fields. The number 1 does not actually appear on the spreadsheet, it simply "t...

P2000 coupla publication questions
P2000 booklet setup cover will be color..not sure if process or spot at this time. the interior pages will be b&w currently i have the entire publication setup for cmyk, should I leave it like this or should I remove the color cover to a separate pub file and make the interior pages b&w?? second; what should I set the trapping up as for the color pages? tnx r ...