Click here to Skip to main content
16,005,169 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: International application Pin
Paolo Messina24-Oct-01 8:16
professionalPaolo Messina24-Oct-01 8:16 
Generalneed help on .inf files Pin
CalamityJake24-Oct-01 4:36
CalamityJake24-Oct-01 4:36 
GeneralCommand ID's Pin
Chambers24-Oct-01 4:33
Chambers24-Oct-01 4:33 
GeneralRe: Command ID's Pin
#realJSOP24-Oct-01 5:05
professional#realJSOP24-Oct-01 5:05 
GeneralRe: Command ID's Pin
Bill Wilson24-Oct-01 6:13
Bill Wilson24-Oct-01 6:13 
GeneralRe: Command ID's Pin
#realJSOP24-Oct-01 6:19
professional#realJSOP24-Oct-01 6:19 
GeneralRe: Command ID's Pin
Bill Wilson24-Oct-01 6:24
Bill Wilson24-Oct-01 6:24 
GeneralRe: Command ID's - displaying status bar test and tooltips etc Pin
24-Oct-01 6:42
suss24-Oct-01 6:42 
Once you have used ON_COMMAND_RANGE etc to map where the messages goto, you can use CMainFrame:GetMessageString to provide the status bar prompt and tooltips.

Example code from an app of mine is:

void CMainFrame::GetMessageString( UINT nID, CString& rMessage ) const
{
if (nID >= REFINESCRIPT_MENU_START_ID && nID <= REFINESCRIPT_MENU_END_ID)
{
rMessage = refineDLL[theApp.nIDtoRefineID[nID - REFINESCRIPT_MENU_START_ID]].DLLMenuStatusBarPrompt(nID /*theApp.nIDtoMenuID[nID - REFINESCRIPT_MENU_START_ID]*/) ;
// remove any tooltip
if (rMessage.Find('\n') >= 0)
rMessage = rMessage.Left(rMessage.Find('\n')) ;
}
else if (nID == ID_TOOLBAR_UNDO || nID == ID_TOOLBAR_REDO)
{
// need to get the active document
CDocTemplate *pTemplate;
CRefineDoc *pDoc = NULL ;
POSITION pos;
bool found = false ;
pos = AfxGetApp()->GetFirstDocTemplatePosition();
do {
pTemplate = (AfxGetApp()->GetNextDocTemplate(pos));
POSITION pos2 ;
pos2 = pTemplate->GetFirstDocPosition();
if (pos2 != NULL)
{
// loop through looking for the active docuement
do {
pDoc = (CRefineDoc*)pTemplate->GetNextDoc(pos2);
if (pDoc->m_bActiveDocument)
found = true ; // found it!
} while (!found && pos2 != NULL) ;
}
} while (!found && pos != NULL) ;
if (pDoc != NULL)
{
CString command ;
if (nID == ID_TOOLBAR_UNDO)
{
// get the undo message text
pDoc->GetUndoText(command) ;
rMessage.Format("Undo command \"%s\"", command) ;
}
else
{
// get the redo message text
pDoc->GetRedoText(command) ;
rMessage.Format("Redo command \"%s\"", command) ;
}
}
else
CMDIFrameWnd::GetMessageString(nID, rMessage) ;
}
else
{
// check to see wether the nID is part of one of the loaded toolbars.
// it it is, we need to load the string from that dll's resources
bool found = false ;
for (int i = 0 ; i < m_ToolbarCount ; i++)
{
if (m_pTB[i]->CommandToIconIndex(nID) >= 0)
{
found = true ;
// get the string from the DLL
rMessage = refineDLL[m_DLLIndexes[i]].DLLMenuStatusBarPrompt(nID) ;
// split the text at an \n
if (rMessage.Find('\n') >= 0)
rMessage = rMessage.Left(rMessage.Find('\n')) ;
}
}
if (!found)
CMDIFrameWnd::GetMessageString(nID, rMessage) ;
}
}

In the function:

REFINESCRIPT_MENU_START_ID = start of the command range allocated
REFINESCRIPT_MENU_END_ID = end of comamnd range allocated

The above code is used in a project where dynamically loaded DLL's are used, which also add menu options etc in. New toolbars may also have been added to the UI.

Hope its of help.Big Grin | :-D
BTW GetMessageString is a virtual function you can override
GeneralRe: Command ID's - displaying status bar test and tooltips etc Pin
Tomasz Sowinski24-Oct-01 7:01
Tomasz Sowinski24-Oct-01 7:01 
Generalnon resizable CFormView Pin
Aviv Halperin24-Oct-01 4:29
Aviv Halperin24-Oct-01 4:29 
GeneralRe: non resizable CFormView Pin
#realJSOP24-Oct-01 5:13
professional#realJSOP24-Oct-01 5:13 
GeneralRe: non resizable CFormView Pin
Paolo Messina24-Oct-01 8:26
professionalPaolo Messina24-Oct-01 8:26 
GeneralRe: non resizable CFormView Pin
#realJSOP24-Oct-01 8:45
professional#realJSOP24-Oct-01 8:45 
GeneralRe: non resizable CFormView Pin
Paolo Messina24-Oct-01 9:29
professionalPaolo Messina24-Oct-01 9:29 
GeneralRGB (for Christian) Pin
24-Oct-01 3:42
suss24-Oct-01 3:42 
GeneralRe: RGB (for Christian) Pin
Christian Graus24-Oct-01 10:33
protectorChristian Graus24-Oct-01 10:33 
GeneralRe: RGB (for Christian) Pin
24-Oct-01 10:59
suss24-Oct-01 10:59 
GeneralRe: RGB (for Christian) Pin
24-Oct-01 11:01
suss24-Oct-01 11:01 
GeneralMenu in a tree control Pin
24-Oct-01 2:55
suss24-Oct-01 2:55 
GeneralRe: Menu in a tree control Pin
Tomasz Sowinski24-Oct-01 3:29
Tomasz Sowinski24-Oct-01 3:29 
Generalabout LoadLibrary Pin
Maer72724-Oct-01 2:31
Maer72724-Oct-01 2:31 
GeneralRe: about LoadLibrary Pin
Tomasz Sowinski24-Oct-01 3:40
Tomasz Sowinski24-Oct-01 3:40 
Generala simple problem about Dll Pin
Maer72724-Oct-01 2:27
Maer72724-Oct-01 2:27 
GeneralRe: a simple problem about Dll Pin
Steen Krogsgaard24-Oct-01 4:36
Steen Krogsgaard24-Oct-01 4:36 
Generaljust a test. don't bother.... Pin
Gilbert Jeiziner24-Oct-01 2:02
Gilbert Jeiziner24-Oct-01 2:02 

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.