Index
Aronson Elliot, Wilson Timothy D., Akert Robin M. Psychologia społeczna (11)
Bettelheim Bruno Cudowne i pożyteczne O znaczeniach i wartoœciach baœni (11)
Dodziuk Anna Psychologia podręczna Częœć III Pokochać (11)
Kratochvil Stanisław Psychoterapia Kierunki metody badania (11)
Zaburzenia psychosomatyczne w praktyce lekarskiej
Chmielewska Joanna Zlota mucha
function.popen
wiedza i zycie2
question ask.tcl page
26 (10)
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • bydgoszczanin.xlx.pl

  • [ Pobierz całość w formacie PDF ]
    .SetCheck()--Checks or unchecks the item.SetRadio()--Checks or unchecks the item as part of a group of radio buttons,only one of which can be set at any time.SetText()--Sets the menu text or button text, if this is a button.DoUpdate()--Generates the message.Determining which member function you want to use is usually clear-cut.Here isa shortened version of the message map from an object called CWhoisView, a classderived from CFormView that is showing information to a user.This form view containsseveral edit boxes, and the user may want to paste text into one of them.The messagemap contains an entry to catch the update for the ID_EDIT_PASTE command, like this:BEGIN_MESSAGE_MAP(CWhoisView, CFormView).ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, OnUpdateEditPaste).END_MESSAGE_MAP()The function that catches the update, OnUpdateEditPaste(), looks like this:void CWhoisView::OnUpdateEditPaste(CCmdUI* pCmdUI){pCmdUI->Enable(::IsClipboardFormatAvailable(CF_TEXT));}This calls the API function ::IsClipboardFormatAvailable() to see whether thereis text in the Clipboard.Other applications may be able to paste in images or othernontext Clipboard contents, but this application cannot and grays the menu item ifthere is no text available to paste.Most command update functions look just likethis: They call Enable() with a parameter that is a call to a function that returnsTRUE or FALSE, or perhaps a simple logical expression.Command update handlers mustbe fast because five to ten of them must run between the moment the user clicks todisplay the menu and the moment before the menu is actually displayed.Learning How ClassWizard Helps You Catch Commands andCommand UpdatesThe ClassWizard dialog box shown in Figure 4.1 has the classname highlighted inthe box labeled Object IDs.Below that are resource IDs of every resource (menu,toolbar, dialog box controls, and so on) that can generate a command or message whenthis object (view, dialog, and so on) is on the screen.If you highlight one of those,the list of messages associated with it is much smaller, as you see in Figure 3.4.Only two messages are associated with each resource ID: COMMAND and UPDATE_COMMAND_UI.The first enables you to add a function to handle the user selecting the menu optionor clicking the button--that is, to catch the command.The second enables you toadd a function to set the state of the menu item, button, or other control just asthe operating system is about to display it--that is, to update the command.(TheCOMMAND choice is boldface in Figure 3.4 because this class already catches thatcommand.)FIG.3.4 ClassWizardenables you to catch or update commands.Clicking Add Function to add a function that catches or updates a command involvesan extra step.ClassWizard gives you a chance to change the default function name,as shown in Figure 3.5.This is almost never appropriate.There is a regular patternto the suggested names, and experienced MFC programmers come to count on functionnames that follow that pattern.Command handler functions, like message handlers,have names that start with On.Typically, the remainder of the function name is formedby removing the ID and the underscores from the resource ID and capitalizing eachword.Command update handlers have names that start with OnUpdate and use the sameconventions for the remainder of the function name.For example, the function thatcatches ID_APP_EXIT should be called OnAppExit(), and the function that updates ID_APP_EXITshould be called OnUpdateAppExit().FIG.3.5 It's possible,but not wise, to change the name for your command handler or command update handlerfrom the name suggested by ClassWizard.Not every command needs an update handler.The framework does some very nice workgraying and ungraying for you automatically.Say you have a menu item--Network, Send--whosecommand is caught by the document.When there is no open document, this menu itemis grayed by the framework, without any coding on your part.For many commands, it'senough that an object that can handle them exists, and no special updating is necessary.For others, you may want to check that something is selected or highlighted or thatno errors are present before making certain commands available.That's when you usecommand updating.If you'd like to see an example of command updating at work, there'sone in Chapter 8 in the "Command Updating" section.© Copyright, Macmillan Computer Publishing.Allrights reserved [ Pobierz całość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • aceton.keep.pl
  • 
    Wszelkie Prawa Zastrzeżone! Kawa była słaba i bez smaku. Nie miała treści, a jedynie formę. Design by SZABLONY.maniak.pl.