Building Interfaces with Microsoft Foundation Classes
I borrowed this book from National Library this month….Quite interesting book that covers ways to coding in MFC (Microsoft Foundation Classes) using Visual C++.. The book covers chapter relating to Control and the User Interface , The Buttons , Edit Boxes , Listboxes and Checklist Boxes , Status Bars and so on….The user interface is one of the most critical aspects of the software development cycle. The most common perception for the use of a control is as a data entry device. Clicking a check box , pushing a button , or entering text into an edit box are all classic examples of ascertaining the user’s intentions.
Command buttons are rectilinear shapes that use either a text label or a graphical icon to represent the action the button performs. A toolbar is a common example of the use of a graphical icon. Text labels are the most common way to describe the function of a button , especially when that function or meaning cannot be easily conveyed by an icon of some sort. Graphical buttons are ideal for dialog boxes that have a lot of screen clutter , because they tend to be smaller in size than buttons with text labels.
There are times when you need to trap certain keystrokes in a dialog box. Generally , these are the Tab and Enter keys. But because dialog boxes have their own message queues , these keystrokes cannot be intercepted in Class Wizard by overriding the WM_CHAR or WM_KEYDOWN messages. There’s another way you can restrict the user’s input into an edit box without subclassing. This involves building a format string , and trapping certain messages in Class Wizard. Sometimes , simply assigning the Number property to an edit box is not enough – you need to allow the use of the plus and minus signs , and the decimal point. A Number-type edit box rejects these characters. One solution is to write a universal method that works much like the formatted input described previously.
Listbox is a control that displays a list of item , such as a list of names or files. List-boxes can have one or more columns , and allow single or multiple selection modes. Listboxes respond to both mouse clicks and keyboard entries. When a user clicks a string , or presses the spacebar while on an item in the listbox , the string is selected. This is indicated by highlighting the string in the listbox , and placing it in the edit box portion of the control.
Beginning with MFC version 4.0 , status bars are implemented using class CStatus-BarCtrl , which encapsulates a Windows95 status bar control. For backward compatibility , MFC retains the older status bar implementation in class COldStatusBar. The class includes a wide range of styles that you can apply in addition to class methods for manipulating it in a variety of ways.
In conclusion , this books covers areas such as common controls , including buttons , boxes , bars , spinners , TreeView and sliders , and there is a Microsoft’s New Common Controls. The book show you how to implement all commonly used controls and dialog boxes , how to add multimedia and so on…A good book to read if you planning coding MFC in Visual C++…
p/s:- Some of the article above is an excerpt from the book Building Better Interfaces with Microsoft Foundation Classes written by Keith Bugg and published by John Wiley and Sons , Inc.