Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem using ON_UPDATE_COMMAND_UI_RANGE macro

dperusodperuso Member Posts: 55
Using VC6, MDI application:
Problem: not seeing correct nID number, in the resource ID_COLOR_BLACK = 32775 when I step through the program the nID number is 1244612.

Thanks in advance.


void CSketcherDoc::ColorSel(CCmdUI* pCmdUI, UINT nID)
{
switch (nID)
{
case ID_COLOR_BLACK:
pCmdUI->SetCheck(m_Color == BLACK);
break;

case ID_COLOR_RED:
pCmdUI->SetCheck(m_Color == RED);
break;

case ID_COLOR_GREEN:
pCmdUI->SetCheck(m_Color == GREEN);
break;

case ID_COLOR_BLUE:
pCmdUI->SetCheck(m_Color == BLUE);
break;

}
}


With:
BEGIN_MESSAGE_MAP(CSketcherDoc, CDocument)
//{{AFX_MSG_MAP(CSketcherDoc)
ON_COMMAND(ID_COLOR_BLACK, OnColorBlack)
ON_COMMAND(ID_COLOR_BLUE, OnColorBlue)
ON_COMMAND(ID_COLOR_GREEN, OnColorGreen)
ON_COMMAND(ID_COLOR_RED, OnColorRed)
ON_COMMAND(ID_ELEMENT_CIRCLE, OnElementCircle)
ON_COMMAND(ID_ELEMENT_CURVE, OnElementCurve)
ON_COMMAND(ID_ELEMENT_LINE, OnElementLine)
ON_COMMAND(ID_ELEMENT_RECTANGLE, OnElementRectangle)
//}}AFX_MSG_MAP
ON_UPDATE_COMMAND_UI_RANGE(ID_ELEMENT_LINE, ID_ELEMENT_CURVE,ElementSel)

ON_UPDATE_COMMAND_UI_RANGE(ID_COLOR_BLACK, ID_COLOR_BLUE, ColorSel)
END_MESSAGE_MAP()

And:
afx_msg void ElementSel(UINT nID);
afx_msg void ColorSel(CCmdUI* pCmdUI, UINT nID);


Comments

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ____ [ http://forcoder.org ] free ebooks and video tutorials about \ Objective-C, Go, Perl, Python, Visual Basic .NET, MATLAB, Delphi, PHP, Scratch, Swift, C#, Java, Assembly, C, JavaScript, Visual Basic, R, Ruby, C++, PL/SQL Scheme, F#, Dart, Prolog, Hack, D, Scala, ABAP, Erlang, Julia, COBOL, ML, Crystal, FoxPro, Logo, Awk, Transact-SQL, Clojure, Alice, SAS, Lisp, Kotlin, Bash, LabVIEW, Fortran, VBScript, Rust, Apex, Ada, Lua \ _____

Sign In or Register to comment.