Hello, everyone.

I'm trying to learn MFC so I can create GUI's for a few projects I have in mind. I could really use your help with a few basic problems.

I'm attaching a screenshot of my appointment book main window and the other dialog that shows after the ADD button is clicked.

All the windows are ListBoxes at the moment, but that might be wrong. Would just keeping the EVENT window a ListBox and using all the other ones as EditControls be better?

Initially, all the Events will be listed in the Events list. Once an Event is selected, the info associated to it (activity, date, time and description) will be posted in the appropriate EditControls(?) windows.

If a Current Week/day/all/past events radio button is selected, the Events list will contain the appropriate items.

Adding functionalities for the Load/Save button would just complicate things at the moment, so I'll leave that for later.

Thus, my goal for the moment is deciding how to implement all of this. Could I get away with simply using a struct? should I build a class, get() and set() functions, constructors? how would the objects be declared and used? should I make a linked list? I'm trying to get this done as good as possible so I will eventually be able to get a job and do good there.

Deciding on which is best, I will still need more answers on how to properly input data (why should I assign a control variable and not a value one, etc) from the EditControls, store it and then use/display it in other EditControls.

I hope I haven't bored you.

Thanks in advance.

Recommended Answers

All 7 Replies

I'm zero in MFC but I would suggest wxWidgets. Many big app are made of it and it si cross platform and... MFC-ish (according to Coders)

I would like to stick with learning MFC, most of the companies here use it.

Anyone?

Any up-to-date books I could read?

First of all you will need to use a database to save all that appointment stuff. The database can be as simple as a text file or as complex as an SQL compliant database such as Microsoft Access, SQL Server, Oracle, Sybase, etc (there are quite a few of them).

Next I would create a structure to hold all the event information for everything in the file and a <vector> of those structures. On program startup read the event file into memory. After that you can populate the list box with the events.

You will need to implement one of the CListBox event handlers so that it's called whenever a line is selected (I don't recall the exact name of the event but you will find it in the list your compiler provides you). Then inside that event handler you can populate all the other controls on the window with the information obtained from the vector of structures.

I like working with MFC -- it can be a lot of fun, but also very challenging. You can get a lot of code and working ideas from www.codeproject.com. I have been a member there for many years and have downloaded lots of free code to use as examples.

You do not need to create a database(Although this is a viable option). MFC has a CArchive class and a serialize function which can be used to create a binary file which will save your data for you(Can load back in etc...). Research it.

You do not need to create a database(Although this is a viable option). MFC has a CArchive class and a serialize function which can be used to create a binary file which will save your data for you(Can load back in etc...). Research it.

You just contridicted yourself. As I said before a database can be as simple as a text or binary file. And IMHO CArchive is terrible for writing normal binary files, and completely useless for writing text files. Better off using fstream, unless you need to serialize MFC windows class objects.

My point was their is a method to create saved files that can all contain different information instead of one large database to read. Trust me dragon, Ive seen you name around these forums enough and know better then to question your opinion. =p

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.