Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Count, frequency, probability Pin
David Crow9-Nov-09 14:11
David Crow9-Nov-09 14:11 
JokeRe: Count, frequency, probability Pin
Michael Schubert10-Nov-09 1:11
Michael Schubert10-Nov-09 1:11 
QuestionRe: Count, frequency, probability Pin
David Crow9-Nov-09 10:30
David Crow9-Nov-09 10:30 
AnswerRe: Count, frequency, probability Pin
zweberhardt9-Nov-09 11:58
zweberhardt9-Nov-09 11:58 
QuestionHow to set "ifstream::rdbuf" bigger? Pin
transoft9-Nov-09 9:18
transoft9-Nov-09 9:18 
AnswerRe: How to set "ifstream::rdbuf" bigger? Pin
Randor 9-Nov-09 11:22
professional Randor 9-Nov-09 11:22 
AnswerRe: How to set "ifstream::rdbuf" bigger? Pin
Saurabh.Garg9-Nov-09 14:15
Saurabh.Garg9-Nov-09 14:15 
QuestionHas anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Dale Haessel9-Nov-09 7:35
Dale Haessel9-Nov-09 7:35 
The MFC example never cuts of button labels but my example cuts off when user resizes window. Even CMFCRibbonBar::ForceRecalcLayout doesn't help.

If we don't use icons, it doesn't cutoff (almost as if it calculates wrong amount of space used for certain icons and then figures out it doesn't have enough room for the label).

See code below => Just wondering if anyone else has seen this or has a way of avoiding it. In our code below, the Divide, Multiply, etc., Next, etc. would cutoff. It is really weird.

CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddCategory(_T("&Home"), IDB_RIBBON_TAB_HOME_SMALL, IDB_RIBBON_TAB_HOME_LARGE);

// Clipboard Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
CString strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_CLIPBOARD;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelClipboard = pCategory->AddPanel(_T("Clipboard"), m_PanelImages.ExtractIcon(12));

    CMFCRibbonButton* pBtnPaste(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Paste"), 12, 13));
    pBtnPaste->SetKeys(_T("V"));
    pPanelClipboard->Add(pBtnPaste);
    CMFCRibbonButton* pBtnCut(new CMFCRibbonButton(ID_EDIT_CUT, _T("Cut"), 13, -1));
    pBtnCut->SetKeys(_T("X"));
    pPanelClipboard->Add(pBtnCut);
    CMFCRibbonButton* pBtnCopy(new CMFCRibbonButton(ID_EDIT_COPY, _T("Copy"), 14, -1));
    pBtnCopy->SetKeys(_T("C"));
    pPanelClipboard->Add(pBtnCopy);
}

// Documents Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_DOCUMENTS;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelDocuments = pCategory->AddPanel(_T("Documents"), m_PanelImages.ExtractIcon(18));
    CMFCRibbonButton* pBtnPrevious(new CMFCRibbonButton(ID_FILE_PREV_WELL, _T("Previous"), 71, -1));
    pBtnPrevious->SetKeys(_T("P"));
    pPanelDocuments->Add(pBtnPrevious);
    CMFCRibbonButton* pBtnNext(new CMFCRibbonButton(ID_FILE_NEXT_WELL, _T("Next"), 70, -1));
    pBtnNext->SetKeys(_T("N"));
    pPanelDocuments->Add(pBtnNext);

    pPanelDocuments->AddSeparator();

    CMFCRibbonButton* pBtnCloseAll(new CMFCRibbonButton(ID_CLOSE_BTN, _T("Close all"), 72, -1));
    pBtnCloseAll->SetMenu(IDR_CLOSE_ALL_MENU, TRUE);
    pBtnCloseAll->SetKeys(_T("DC"));
    pPanelDocuments->Add(pBtnCloseAll);

    pCategory->AddHidden(new CMFCRibbonButton(ID_CLOSE_ALL, _T("Close all"), 72));
    pCategory->AddHidden(new CMFCRibbonButton(ID_CLOSE_ALL_EXCEPT, _T("Close all except document in focus"), 144));

    CMFCRibbonButton* pBtnOpenLinked(new CMFCRibbonButton(ID_OPEN_LINKED, _T("Open linked"), 73, -1));
    pBtnOpenLinked->SetMenu(IDR_OPEN_LINKED_MENU);
    pBtnOpenLinked->SetKeys(_T("DO"));
    pPanelDocuments->Add(pBtnOpenLinked);

    pCategory->AddHidden(new CMFCRibbonButton(ID_SHOW_CASE, _T("Case"), 58));
    pCategory->AddHidden(new CMFCRibbonButton(ID_SHOW_FORECAST, _T("Well"), 127));
    pCategory->AddHidden(new CMFCRibbonButton(ID_OPEN_LINKED_MODEL, _T("Model"), 66));
    pCategory->AddHidden(new CMFCRibbonButton(ID_OPEN_LINKED_CURRENCY, _T("Currency"), 0));
    pCategory->AddHidden(new CMFCRibbonButton(ID_OPEN_LINKED_GLOBAL_PARM, _T("Global Parameters"), 0));
    pCategory->AddHidden(new CMFCRibbonButton(ID_OPEN_LINKED_PRECEEDING_CASE, _T("Preceding Case"), 58));

    CMFCRibbonButton* pBtnRevert(new CMFCRibbonButton(ID_REVERT_TO_LAST_SAVED, _T("Revert"), 18, 14));
    pBtnRevert->SetKeys(_T("DR"));
    pPanelDocuments->Add(pBtnRevert);
}

// Column Operations Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_COLUMN_OP;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelOperations = pCategory->AddPanel(_T("Column operations"), m_PanelImages.ExtractIcon(96));

    CMFCRibbonButton* pBtnMultiply(new CMFCRibbonButton(ID_OPERATION_MATH_MULTIPLY, _T("Multiply"), 50, -1));
    pBtnMultiply->SetKeys(_T("MM"));
    pPanelOperations->Add(pBtnMultiply);
    CMFCRibbonButton* pBtnDivide(new CMFCRibbonButton(ID_OPERATION_MATH_DIVIDE, _T("Divide"), 51, -1));
    pBtnDivide->SetKeys(_T("MD"));
    pPanelOperations->Add(pBtnDivide);
    CMFCRibbonButton* pBtnAdd(new CMFCRibbonButton(ID_OPERATION_MATH_ADD, _T("Add"), 48, -1));
    pBtnAdd->SetKeys(_T("MA"));
    pPanelOperations->Add(pBtnAdd);
    CMFCRibbonButton* pBtnSubtract(new CMFCRibbonButton(ID_OPERATION_MATH_SUBTRACT, _T("Subtract"), 49, -1));
    pBtnSubtract->SetKeys(_T("MS"));
    pPanelOperations->Add(pBtnSubtract);

    pPanelOperations->AddSeparator();

    CMFCRibbonButton* pBtnCopyDown(new CMFCRibbonButton(ID_OPERATION_DUP, _T("Copy down"), 45, -1));
    pBtnCopyDown->SetKeys(_T("OC"));
    pPanelOperations->Add(pBtnCopyDown);
    CMFCRibbonButton* pBtnEscalate(new CMFCRibbonButton(ID_OPERATION_ESCALATE, _T("Escalate"), 47, -1));
    pBtnEscalate->SetKeys(_T("OE"));
    pPanelOperations->Add(pBtnEscalate);
    CMFCRibbonButton* pBtnDecline(new CMFCRibbonButton(ID_OPERATION_DECLINE, _T("Decline"), 46, -1));
    pBtnDecline->SetKeys(_T("OD"));
    pPanelOperations->Add(pBtnDecline);
}

// Column Display Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_COLUMN_DISPLAY;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelDisplay = pCategory->AddPanel(_T("Column display"), m_PanelImages.ExtractIcon(95));

    CMFCRibbonButtonsGroup* pGroupPeriod = new CMFCRibbonButtonsGroup();

    CMFCRibbonButton* pBtnMonthly(new CMFCRibbonButton(ID_DISPLAY_MONTH, _T(""), 41, -1));
    pBtnMonthly->SetKeys(_T("FM"));
    pGroupPeriod->AddButton(pBtnMonthly);
    CMFCRibbonButton* pBtnQuarter(new CMFCRibbonButton(ID_DISPLAY_QUARTER, _T(""), 42, -1));
    pBtnQuarter->SetKeys(_T("FQ"));
    pGroupPeriod->AddButton(pBtnQuarter);
    CMFCRibbonButton* pBtnSemi(new CMFCRibbonButton(ID_DISPLAY_SEMI, _T(""), 43, -1));
    pBtnSemi->SetKeys(_T("FS"));
    pGroupPeriod->AddButton(pBtnSemi);
    CMFCRibbonButton* pBtnYear(new CMFCRibbonButton(ID_DISPLAY_YEAR, _T(""), 44, -1));
    pBtnYear->SetKeys(_T("FY"));
    pGroupPeriod->AddButton(pBtnYear);

    pPanelDisplay->Add(pGroupPeriod);

    CMFCRibbonButtonsGroup* pGroupNominal = new CMFCRibbonButtonsGroup();

    CMFCRibbonButton* pBtnReal(new CMFCRibbonButton(ID_OPERATION_REAL, _T("Real"), -1, -1));
    pBtnReal->SetKeys(_T("FR"));
    pGroupNominal->AddButton(pBtnReal);
    CMFCRibbonButton* pBtnNominal(new CMFCRibbonButton(ID_OPERATION_NOMINAL, _T("Nominal"), -1, -1));
    pBtnNominal->SetKeys(_T("FN"));
    pGroupNominal->AddButton(pBtnNominal);

    pPanelDisplay->Add(pGroupNominal);

    CMFCRibbonButton* pBtnRatio(new CMFCRibbonButton(ID_OPERATION_RATIO, _T("Ratio"), 19, 15));
    pBtnRatio->SetKeys(_T("FA"));
    pPanelDisplay->Add(pBtnRatio);
}

// Unit Settings Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_UNIT_SETTINGS;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelUnits = pCategory->AddPanel(_T("Unit settings"), m_PanelImages.ExtractIcon(98));

    CPeepRibbonComboBox* pUnitTypeComboBox = new CPeepRibbonComboBox(ID_UNIT_TYPE, FALSE, 50, _T("Units:"), 113);
    pUnitTypeComboBox->SetKeys(_T("UU"));
    pUnitTypeComboBox->AddItem(_T("Imperial"), ID_UNIT_TYPE_IMPERIAL);
    pUnitTypeComboBox->AddItem(_T("Metric"), ID_UNIT_TYPE_METRIC);
    pUnitTypeComboBox->AddItem(_T("Alternate"), ID_UNIT_TYPE_ALTERNATE);
    pUnitTypeComboBox->SelectItem(0);
    pPanelUnits->Add(pUnitTypeComboBox);

    CPeepRibbonComboBox* pUnitScaleComboBox = new CPeepRibbonComboBox(ID_UNIT_SCALE, FALSE, 50, _T("Scale:"), 112);
    pUnitScaleComboBox->SetKeys(_T("UC"));
    pUnitScaleComboBox->AddItem(_T("Small"), ID_UNIT_SCALE_SMALL);
    pUnitScaleComboBox->AddItem(_T("Medium"), ID_UNIT_SCALE_MEDIUM);
    pUnitScaleComboBox->AddItem(_T("Large"), ID_UNIT_SCALE_LARGE);
    mUnitScale unitScale = DefUnitScale();
    switch (unitScale)
    {
        case UNITS_SMALL:
        {
            pUnitScaleComboBox->SelectItem(0);
            break;
        }
        case UNITS_MEDIUM:
        {
            pUnitScaleComboBox->SelectItem(1);
            break;
        }
        case UNITS_LARGE:
        {
            pUnitScaleComboBox->SelectItem(2);
            break;
        }
    }
    pPanelUnits->Add(pUnitScaleComboBox);

    pPanelUnits->EnableLaunchButton(ID_UNIT_SETTINGS, -1, _T("US"));
}

// Results Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_RESULTS;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelResults = pCategory->AddPanel(_T("Results"), m_PanelImages.ExtractIcon(20));
    CMFCRibbonButton* pBtnCalculate(new CMFCRibbonButton(ID_PEEP_CALC, _T("Calculate"), 20, 16));
    pBtnCalculate->SetKeys(_T("RC"));
    pPanelResults->Add(pBtnCalculate);
}

// Scenarios Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_SCENARIOS;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelScenarios = pCategory->AddPanel(_T("Scenarios"), m_PanelImages.ExtractIcon(21));
    CMFCRibbonButton* pBtnManageScenarios(new CMFCRibbonButton(ID_SCENARIO, _T("Manage"), 21, 17));
    pBtnManageScenarios->SetKeys(_T("S"));
    pPanelScenarios->Add(pBtnManageScenarios);
}

// Columns and Properties Panel

// Check profile.  If there is no Ribbon profile or no entry for this tag, default is to display
strID = RIBBON_TAB_HOME + szSeperator + RIBBON_GP_COLUMN_PROP;
if (_ShouldDisplayRibbonControlGroup(piRibbon, strID, strLabel))
{
    CMFCRibbonPanel* pPanelProperties = pCategory->AddPanel(_T("Columns and properties"), m_PanelImages.ExtractIcon(97));
    CMFCRibbonButton* pBtnAddColumn(new CMFCRibbonButton(ID_EDIT_ADD_COL, _T("Add"), 52, -1));
    pBtnAddColumn->SetKeys(_T("PA"));
    pPanelProperties->Add(pBtnAddColumn);
    CMFCRibbonButton* pBtnEditColumn(new CMFCRibbonButton(ID_EDIT_EDIT_COL, _T("Edit"), 54, -1));
    pBtnEditColumn->SetKeys(_T("PE"));
    pPanelProperties->Add(pBtnEditColumn);
    CMFCRibbonButton* pBtnRemoveColumn(new CMFCRibbonButton(ID_EDIT_DEL_COL, _T("Remove"), 53, -1));
    pBtnRemoveColumn->SetKeys(_T("PR"));
    pPanelProperties->Add(pBtnRemoveColumn);
    CMFCRibbonButton* pBtnAddInOptions(new CMFCRibbonButton(ID_CASE_ADDIN_DATA, _T("Add-in settings"), 55, -1));
    pBtnAddInOptions->SetKeys(_T("PO"));
    pPanelProperties->Add(pBtnAddInOptions);
    CMFCRibbonButton* pBtnDefinition(new CMFCRibbonButton(ID_COLUMN_DEFINITION, _T("Definition"), 56, -1));
    pBtnDefinition->SetKeys(_T("PD"));
    pPanelProperties->Add(pBtnDefinition);
    CMFCRibbonButton* pBtnModelHelp(new CMFCRibbonButton(ID_MODEL_HELP_TEXT, _T("Model help text"), 57, -1));
    pBtnModelHelp->SetKeys(_T("PH"));
    pPanelProperties->Add(pBtnModelHelp);
}

// Oil in Mass Panel
bool bMassLicense = GETAPP->HasMassLicense();
if (bMassLicense)
{
    CMFCRibbonPanel* pPanelOilInMass = pCategory->AddPanel(_T("Oil in mass"), m_PanelImages.ExtractIcon(99));
    CMFCRibbonButton* pBtnMass(new CMFCRibbonButton(ID_QUANTITY_MASS, _T("Mass measurement"), 99, 97));
    pBtnMass->SetKeys(_T("OM"));
    pPanelOilInMass->Add(pBtnMass);
    CMFCRibbonButton* pBtnVolume(new CMFCRibbonButton(ID_QUANTITY_VOLUME, _T("Volume measurement"), 100, 98));
    pBtnVolume->SetKeys(_T("OV"));
    pPanelOilInMass->Add(pBtnVolume);
}

AnswerRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Dale Haessel9-Nov-09 9:16
Dale Haessel9-Nov-09 9:16 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Randor 9-Nov-09 11:42
professional Randor 9-Nov-09 11:42 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Dale Haessel9-Nov-09 12:06
Dale Haessel9-Nov-09 12:06 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Randor 9-Nov-09 12:18
professional Randor 9-Nov-09 12:18 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Dale Haessel9-Nov-09 12:51
Dale Haessel9-Nov-09 12:51 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Randor 9-Nov-09 12:42
professional Randor 9-Nov-09 12:42 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Dale Haessel9-Nov-09 12:54
Dale Haessel9-Nov-09 12:54 
GeneralRe: Has anyone encountered labels cutting off using the Ribbon Toolbar? Pin
Randor 10-Nov-09 6:45
professional Randor 10-Nov-09 6:45 
QuestionRibbon Bar creates multiple menu items with same name Pin
Dale Haessel9-Nov-09 7:10
Dale Haessel9-Nov-09 7:10 
AnswerRe: Ribbon Bar creates multiple menu items with same name Pin
Randor 9-Nov-09 8:13
professional Randor 9-Nov-09 8:13 
GeneralRe: Ribbon Bar creates multiple menu items with same name Pin
Dale Haessel9-Nov-09 9:35
Dale Haessel9-Nov-09 9:35 
GeneralRe: Ribbon Bar creates multiple menu items with same name Pin
Randor 9-Nov-09 10:54
professional Randor 9-Nov-09 10:54 
GeneralRe: Ribbon Bar creates multiple menu items with same name Pin
Dale Haessel9-Nov-09 12:37
Dale Haessel9-Nov-09 12:37 
GeneralRe: Ribbon Bar creates multiple menu items with same name Pin
Randor 9-Nov-09 13:15
professional Randor 9-Nov-09 13:15 
QuestionIncrease mainframe window if right side of inserted view is out of MainFrames client area [modified] Pin
Fusshoeller9-Nov-09 7:05
Fusshoeller9-Nov-09 7:05 
AnswerRe: Increase mainframe window if right side of inserted view is out of MainFrames client area Pin
«_Superman_»9-Nov-09 8:02
professional«_Superman_»9-Nov-09 8:02 
GeneralRe: Increase mainframe window if right side of inserted view is out of MainFrames client area Pin
Fusshoeller9-Nov-09 8:33
Fusshoeller9-Nov-09 8:33 

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.