Monday, October 26, 2009

Exercises



[ Team LiB ]










Exercises



Exercise 27.1: Add two game size buttons


We will probably use the Medium and Large game sizes the most. Add toolbar buttons for these two menu commands. Draw the buttons yourself.



Exercise 27.2: Add Window | New and Window | Tile buttons


The Pop menu labels the standard Window | New button as Window | Additional View of current game. Add a toolbar button for this menu command. Instead of drawing the button yourself see if you can find a way to copy it from somewhere else. One approach is to look for appropriate *.bmp
images on your hard drive. Visual Studio, in particular, will have a lot of them in its subdirectories.



Exercise 27.3: Adding an accelerator key


Make the Ctrl+A combination be an accelerator for Window | New.



Exercise 27.4: Changing the caption


If you wanted to, you could write your information into the caption bar instead of into the status bar, using lines like the following. But there are reasons not to do this.



CPopDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->SetTitle(pgame()->statusMessage());

Try this and check what happens when you maximize a view. Check what happens when you use File | New to open an additional game document. Can you tell which view corresponds to which document?






    [ Team LiB ]



    No comments: