Click here to Skip to main content
15,906,248 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: How to make the cursor move to the next ctrol of EDIT automatic? Pin
titan_sky_king5-Jan-09 17:45
titan_sky_king5-Jan-09 17:45 
AnswerRe: How to make the cursor move to the next ctrol of EDIT automatic? Pin
Mark Salsbery4-Jan-09 15:17
Mark Salsbery4-Jan-09 15:17 
JokeRe: How to make the cursor move to the next ctrol of EDIT automatic? Pin
titan_sky_king5-Jan-09 17:46
titan_sky_king5-Jan-09 17:46 
QuestionMenus Pin
BobInNJ4-Jan-09 5:59
BobInNJ4-Jan-09 5:59 
AnswerRe: Menus Pin
Mark Salsbery4-Jan-09 6:38
Mark Salsbery4-Jan-09 6:38 
GeneralRe: Menus Pin
BobInNJ4-Jan-09 11:38
BobInNJ4-Jan-09 11:38 
GeneralRe: Menus Pin
Richard Andrew x644-Jan-09 12:17
professionalRichard Andrew x644-Jan-09 12:17 
GeneralRe: Menus Pin
Mark Salsbery4-Jan-09 15:10
Mark Salsbery4-Jan-09 15:10 
BobInNJ wrote:
I am not sure what you are saying


I'm saying typically Selection a, Selection b, etc. each have an associated command
(for example, using the wizards, ID_SELECTION1_SELECTIONA)
// menu resource

IDR_MYMENU MENU 
BEGIN
    POPUP "Selection 1"
    BEGIN
        MENUITEM "Selection a",                 ID_SELECTION1_SELECTIONA
        MENUITEM "Selection  b",                ID_SELECTION1_SELECTIONB
    END
END



// added to message map of menu's window class
    ON_UPDATE_COMMAND_UI(ID_SELECTION1_SELECTIONA, &CMainFrame::OnUpdateSelection1Selectiona)
...
// added to menu's window class
void CMyMenuWindowFrame::OnUpdateSelection1Selectiona(CCmdUI *pCmdUI)
{
    if (some_state)
        pCmdUI->Enable(TRUE);
    else
        pCmdUI->Enable(FALSE);
}


Three advantages of using the command macros are:
1) MFC does the work for you
2) The IDE has wizards to add the command handler and enabler functions with just clicks
3) If you have a toolbar or possibly other context menu(s) with equivalent
commands, you only have to write the enabling code in one place.

That's the MFC way.....you are free to do it manually if you want to.

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Menus Pin
BobInNJ5-Jan-09 12:08
BobInNJ5-Jan-09 12:08 
QuestionCBrush - color Pin
korte254-Jan-09 5:11
korte254-Jan-09 5:11 
AnswerRe: CBrush - color Pin
CPallini4-Jan-09 5:20
mveCPallini4-Jan-09 5:20 
GeneralRe: CBrush - color Pin
korte254-Jan-09 5:41
korte254-Jan-09 5:41 
GeneralRe: CBrush - color Pin
CPallini4-Jan-09 5:42
mveCPallini4-Jan-09 5:42 
QuestionWebbrowser control + ActiveX Pin
nobaq4-Jan-09 3:39
nobaq4-Jan-09 3:39 
QuestionRe: Webbrowser control + ActiveX Pin
nobaq4-Jan-09 4:10
nobaq4-Jan-09 4:10 
AnswerRe: Webbrowser control + ActiveX Pin
nobaq5-Jan-09 2:00
nobaq5-Jan-09 2:00 
Questionstatic-inheritance problem Pin
KasyaMafia4-Jan-09 3:32
KasyaMafia4-Jan-09 3:32 
QuestionRe: static-inheritance problem Pin
CPallini4-Jan-09 3:42
mveCPallini4-Jan-09 3:42 
AnswerRe: static-inheritance problem Pin
KasyaMafia4-Jan-09 4:33
KasyaMafia4-Jan-09 4:33 
GeneralRe: static-inheritance problem Pin
CPallini4-Jan-09 4:54
mveCPallini4-Jan-09 4:54 
GeneralRe: static-inheritance problem [modified] Pin
KasyaMafia4-Jan-09 5:59
KasyaMafia4-Jan-09 5:59 
QuestionRe: static-inheritance problem Pin
CPallini4-Jan-09 6:14
mveCPallini4-Jan-09 6:14 
JokeRe: static-inheritance problem Pin
Mark Salsbery4-Jan-09 6:42
Mark Salsbery4-Jan-09 6:42 
GeneralRe: static-inheritance problem Pin
CPallini4-Jan-09 10:17
mveCPallini4-Jan-09 10:17 
GeneralRe: static-inheritance problem Pin
Mark Salsbery4-Jan-09 15:22
Mark Salsbery4-Jan-09 15:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.