The last step is to display the new value in m_sum, and we do that with another call to UpdateData(), this time passing a value of false to update the display.
Thats all it takes. Run the program now: A new calculator form appears in an MDI child window, as shown in Figure 3.5. The controls in that calculator are active as well because were supporting MDI calculators, thanks to form views.
So far, weve seen rich edit views and form views, and there are more powerful views to come. We see the first of those now as we turn to HTML views.
An HTML view is built on the Web browser control, which is already installed in your computer if you have Internet Explorer. This view is extraordinary. With it, you can navigate to any URL. Lets put this view to use in a new project, HTMLView.
Create a new MDI project, HTMLView. In Step 6 of AppWizard, select CHtmlView as the base class for our view and click Finish to create the project. The CHtmlView class functions appear in Table 3.2.
|
Table 3.2 CHtmlView Classs Functions
|
|
Function
| Does this
|
Create
| Creates the WebBrowser control.
|
ExecWB
| Executes a command.
|
GetAddressBar
| Determines whether the Internet Explorer objects address bar is visible. (WebBrowser control ignores; Internet Explorer only.)
|
GetApplication
| Retrieves an application object representing the application that contains the current instance of the Internet Explorer application.
|
GetBusy
| Retrieves a value indicating whether a download or other activity is still in progress.
|
GetContainer
| Retrieves the container of the WebBrowser control.
|
GetFullName
| Retrieves the full name, including the path, of the resource displayed in the Web browser. (WebBrowser control ignores; Internet Explorer only.)
|
GetFullScreen
| Indicates whether the WebBrowser control is operating in full-screen mode or in normal window mode.
|
GetHeight
| Retrieves the height of the Internet Explorer main window.
|
GetHtmlDocument
| Retrieves the active HTML document.
|
GetLeft
| Retrieves the screen coordinate of the left edge of the Internet Explorer main window.
|
GetLocationName
| Retrieves the name of the resource that WebBrowser is currently displaying.
|
GetLocationURL
| Retrieves the URL of the resource that WebBrowser is currently displaying.
|
GetMenuBar
| Retrieves a value that determines whether the menu bar is visible.
|
GetOffline
| Retrieves a value that determines whether the control is offline.
|
GetParentBrowser
| Retrieves a pointer to the IDispatch interface of the object that is the container of the WebBrowser control.
|
GetProperty
| Retrieves the current value of a property associated with the given object.
|
GetReadyState
| Retrieves the ready state of the WebBrowser object.
|
GetRegisterAsBrowser
| Indicates whether the WebBrowser control is registered as a top-level browser for target name resolution.
|
GetRegisterAsDropTarget
| Indicates whether the WebBrowser control is registered as a drop target for navigation.
|
GetSilent
| Indicates whether any dialog boxes can be shown.
|
GetStatusBar
| Indicates whether the Internet Explorers status bar is visible. (WebBrowser control ignores; Internet Explorer only.)
|
GetTheaterMode
| Indicates whether the WebBrowser control is in theater mode.
|
GetToolBar
| Retrieves a value that determines whether the toolbar is visible.
|
GetTop
| Retrieves the screen coordinate of the top edge of the Internet Explorer main window.
|
GetTopLevelContainer
| Retrieves a value indicating whether the current object is the top-level container of the WebBrowser control.
|
GetType
| Retrieves the type name of the document object.
|
GetVisible
| Retrieves a value indicating whether the object is visible or hidden.
|
GoBack
| Navigates to the previous item in the history list.
|
GoForward
| Navigates to the next item in the history list.
|
GoHome
| Navigates to the current home or start page.
|
GoSearch
| Navigates to the current search page.
|
LoadFromResource
| Loads a resource in the WebBrowser control.
|
Navigate
| Navigates to the resource identified by a URL.
|
Navigate2
| Navigates to the resource identified by a URL or to the file identified by a full path.
|
OnBeforeNavigate2
| Called before a navigation occurs in the given WebBrowser (on either a window or frameset element).
|
OnCommandStateChange
| Called to notify an application that the enabled state of a Web browser command has changed.
|
OnDocumentComplete
| Called to notify an application that a document has reached the READYSTATE_COMPLETE state.
|
OnDownloadBegin
| Called to notify an application that a navigation operation is beginning.
|
OnDownloadComplete
| Called when a navigation operation finished, was halted, or failed.
|
OnDraw
| Called to render an image of the document for screen display, printing, or print preview.
|
OnFullScreen
| Called when the FullScreen property has changed.
|
OnMenuBar
| Called when the MenuBar property has changed.
|
OnNavigateComplete2
| Called after a navigation to a hyperlink completes (on either a window or frameset element).
|
OnNewWindow2
| Called when a new window is to be created for displaying a resource.
|
OnProgressChange
| Called to notify an application that the progress of a download operation has been updated.
|
OnPropertyChange
| Called to notify an application that the PutProperty method has changed the value of a property.
|
OnQuit
| Called to notify an application that the Internet Explorer application is ready to quit. (Applies to Internet Explorer only.)
|
OnStatusBar
| Called when the StatusBar property has changed.
|
OnStatusTextChange
| Called to notify an application that the text of the status bar associated with the WebBrowser control has changed.
|
OnTheaterMode
| Called when the TheaterMode property has changed.
|
OnTitleChange
| Called to notify an application when the title of a document in the WebBrowser control becomes available or changes.
|
OnToolBar
| Called when the ToolBar property has changed.
|
OnVisible
| Called when the window for the WebBrowser control should be shown/hidden.
|
PutProperty
| Sets the value of a property associated with the given object.
|
QueryStatusWB
| Queries the status of a command being processed by the WebBrowser control.
|
Refresh
| Reloads the current file.
|
Refresh2
| Reloads the current file and optionally prevents the pragma:nocache header from being sent.
|
SetAddressBar
| Shows or hides the Internet Explorer objects address bar. (WebBrowser control ignores; Internet Explorer only.)
|
SetFullScreen
| Sets a value to determine whether the control is operating in full-screen mode or in normal window mode. (WebBrowser control ignores; Internet Explorer only.)
|
SetHeight
| Sets the height of the Internet Explorer main window.
|
SetLeft
| Sets the horizontal position of the Internet Explorer main window.
|
SetMenuBar
| Sets a value to determine whether the controls menu bar is visible. (WebBrowser control ignores; Internet Explorer only.)
|
SetOffline
| Sets a value to determine whether the control is offline.
|
SetRegisterAsBrowser
| Sets a value indicating whether the WebBrowser control is registered as a top-level browser for target name resolution.
|
SetRegisterAsDropTarget
| Sets a value indicating whether the WebBrowser control is registered as a drop target for navigation.
|
SetSilent
| Sets a value to determine whether the control will display dialog boxes.
|
SetStatusBar
| Sets a value to determine whether the Internet Explorers status bar is visible. (WebBrowser control ignores; Internet Explorer only.)
|
SetTheaterMode
| Sets a value indicating whether the WebBrowser control is in theater mode.
|
SetToolBar
| Sets a value to determine whether the controls toolbar is visible. (WebBrowser control ignores; Internet Explorer only.)
|
SetTop
| Sets the vertical position of the Internet Explorer main window.
|
SetVisible
| Sets a value indicating whether the object is visible or hidden.
|
Stop
| Stops opening a file.
|
|