Archive for September, 2015

h1

Building Interfaces with Microsoft Foundation Classes and Javascript….

September 21, 2015

Building Interfaces with Microsoft Foundation Classes

mfc 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.

JavaScript.

javascript

Borrowed this book from National Library (PNM) this month . A book that tells and taught us about how to coding in Javascript language using HTML and Javascript language…Some programming language must be compiled , or translated , into machine code before they can be executed. Javascript , on the other hand , is an interpreted language. The browser executes each line of script as it comes to it. Although many programming languages are complex , scripting languages are generally simple. Web scripting languages enable you to combine scripting with HTML to create interactive web pages.

When you create more complicated scripts , you’ll quickly find your HTML documents become large and confusing. To avoid this , you can use one or more external Javascript files. These are files with the .js extension that contain Javascript statements. A variety of dedicated HTML editors is also available and will work with Javascript. In fact , many include feature specifically for Javascript – for example , color-coding the various Javascript statements to indicate their purposes , or even creating simple scripts automatically.

So far , you’ve seen some Javascript statements that have a section in parentheses , like this:

document.write(“Testing.”);

This is an example of a function. Functions provide a simple way to handle a task , such as adding output to a web page. Javascript includes a wide variety of built-in functions , which you will learn about. A statement that uses a function , as in the preceding example , is referred to as a function call. Javascript  also supports objects. Like variables , objects can store data – but they can store two or more pieces of data at once. The item of data stored in an object are called the properties of the object. Javascript uses periods to separate object names and property names. Objects can also include methods. These are functions that work with the object’s data. Each event handler is associated with a particular browser object , and you can specify the event handler in the tag that defines the object. You specify the event handler as an attribute to the HTML tag and include the Javascript statements to handle the event within the quotation mark. This is an ideal use for functions because function names are short and to the point and can refer to a whole series of statements.

In Conclusion , this book teaches us to use Javascript to build dynamic interactive web pages , debug scripts , create scripts that work in all browsers , exploit the capabilities of Javascript , using CSS with simple Javascript , add AJAX effects to your web pages and many more…The book teaches about the fundamental of using Javascript programming…

p/s:- Some of the article is an excerpt from the book Javascript in 24 Hours , written by Michael Moncur and published by SAMS Publishing.