|
When the debug runs and release doesn't, it's very often a case of uninitialized variables or improper use of the ASSERT macros.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
|
zweberhardt wrote: My assignment is to accept a string of up to 256 characters from the user, and display the following information about the string...
Do your own homework. I will refrain from spelling out just how stupid it looks to ask questions like this.
Or maybe I won't.
|
|
|
|
|
|
Hey, at least you seem to get it. I just love the individuals who seem to think they're entitled to a free ride.
Take a crack at the assignment and if you have trouble, identify a specific problem(s) and I'm sure people will be willing to help.
|
|
|
|
|
zweberhardt wrote: a fellow student mentioned in passing that you can get "free" answers by asking questions that way.
If you had not included those last two words, that would have been a true statement. People here are more than willing to help.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
zweberhardt wrote: a fellow student mentioned in passing that you can get "free" answers by asking questions that way
I know that guy. He posted a homework assignment here last week and was told to f*** off and do his homework by himself.
Maybe he doesn't like you very much...
|
|
|
|
|
zweberhardt wrote: My assignment is to...
I need a code to that displays the above information.
So would you be turning in this assignment under the guise that you created it?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I deserved that. Won't happen again.
|
|
|
|
|
Hi
I am using following code to read in a bitmap file.
ifstream bifs( pFileName );
istream IStream(bifs.rdbuf());
But when I tried to use "istream.read( ... )" to get file data back, I can not get all the data in the file.
How can I solve this problem?
Thanks,
|
|
|
|
|
|
You should open file in binary mode.
-Saurabh
|
|
|
|
|
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);
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);
}
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);
}
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);
}
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);
}
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"));
}
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);
}
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);
}
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);
}
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);
}
|
|
|
|
|
I just checked and the MSOffice2007Demo does cut off but not that much. Take the Demo code and replace the Home tab w/ the following and lots of labels get cutoff.
CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddCategory(_T("Home\nh"), IDB_WRITE, IDB_WRITELARGE);
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);
CMFCRibbonPanel* pPanelDocuments = pCategory->AddPanel(_T("Documents"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButton* pBtnPrevious(new CMFCRibbonButton(ID_EDIT_COPY, _T("Previous"), 14, -1));
pBtnPrevious->SetKeys(_T("P"));
pPanelDocuments->Add(pBtnPrevious);
CMFCRibbonButton* pBtnNext(new CMFCRibbonButton(ID_EDIT_COPY, _T("Next"), 14, -1));
pBtnNext->SetKeys(_T("N"));
pPanelDocuments->Add(pBtnNext);
pPanelDocuments->AddSeparator();
CMFCRibbonButton* pBtnCloseAll(new CMFCRibbonButton(ID_EDIT_COPY, _T("Close all"), 14, -1));
pBtnCloseAll->SetMenu(IDR_WRITE_PASTE_MENU, TRUE);
pBtnCloseAll->SetKeys(_T("DC"));
pPanelDocuments->Add(pBtnCloseAll);
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Close all"), 14));
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Close all except document in focus"), 14));
CMFCRibbonButton* pBtnOpenLinked(new CMFCRibbonButton(ID_EDIT_COPY, _T("Open linked"), 14, -1));
pBtnOpenLinked->SetMenu(IDR_WRITE_PASTE_MENU);
pBtnOpenLinked->SetKeys(_T("DO"));
pPanelDocuments->Add(pBtnOpenLinked);
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Case"), 14));
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Well"), 14));
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Model"), 14));
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Currency"), 0));
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Global Parameters"), 0));
pCategory->AddHidden(new CMFCRibbonButton(ID_EDIT_COPY, _T("Preceding Case"), 14));
CMFCRibbonButton* pBtnRevert(new CMFCRibbonButton(ID_EDIT_COPY, _T("Revert"), 14, 14));
pBtnRevert->SetKeys(_T("DR"));
pPanelDocuments->Add(pBtnRevert);
CMFCRibbonPanel* pPanelOperations = pCategory->AddPanel(_T("Column operations"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButton* pBtnMultiply(new CMFCRibbonButton(ID_EDIT_COPY, _T("Multiply"), 14, -1));
pBtnMultiply->SetKeys(_T("MM"));
pPanelOperations->Add(pBtnMultiply);
CMFCRibbonButton* pBtnDivide(new CMFCRibbonButton(ID_EDIT_COPY, _T("Divide"), 14, -1));
pBtnDivide->SetKeys(_T("MD"));
pPanelOperations->Add(pBtnDivide);
CMFCRibbonButton* pBtnAdd(new CMFCRibbonButton(ID_EDIT_COPY, _T("Add"), 14, -1));
pBtnAdd->SetKeys(_T("MA"));
pPanelOperations->Add(pBtnAdd);
CMFCRibbonButton* pBtnSubtract(new CMFCRibbonButton(ID_EDIT_COPY, _T("Subtract"), 14, -1));
pBtnSubtract->SetKeys(_T("MS"));
pPanelOperations->Add(pBtnSubtract);
pPanelOperations->AddSeparator();
CMFCRibbonButton* pBtnCopyDown(new CMFCRibbonButton(ID_EDIT_COPY, _T("Copy down"), 14, -1));
pBtnCopyDown->SetKeys(_T("OC"));
pPanelOperations->Add(pBtnCopyDown);
CMFCRibbonButton* pBtnEscalate(new CMFCRibbonButton(ID_EDIT_COPY, _T("Escalate"), 14, -1));
pBtnEscalate->SetKeys(_T("OE"));
pPanelOperations->Add(pBtnEscalate);
CMFCRibbonButton* pBtnDecline(new CMFCRibbonButton(ID_EDIT_COPY, _T("Decline"), 14, -1));
pBtnDecline->SetKeys(_T("OD"));
pPanelOperations->Add(pBtnDecline);
CMFCRibbonPanel* pPanelDisplay = pCategory->AddPanel(_T("Column display"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButtonsGroup* pGroupPeriod = new CMFCRibbonButtonsGroup();
CMFCRibbonButton* pBtnMonthly(new CMFCRibbonButton(ID_EDIT_COPY, _T(""), 14, -1));
pBtnMonthly->SetKeys(_T("FM"));
pGroupPeriod->AddButton(pBtnMonthly);
CMFCRibbonButton* pBtnQuarter(new CMFCRibbonButton(ID_EDIT_COPY, _T(""), 14, -1));
pBtnQuarter->SetKeys(_T("FQ"));
pGroupPeriod->AddButton(pBtnQuarter);
CMFCRibbonButton* pBtnSemi(new CMFCRibbonButton(ID_EDIT_COPY, _T(""), 14, -1));
pBtnSemi->SetKeys(_T("FS"));
pGroupPeriod->AddButton(pBtnSemi);
CMFCRibbonButton* pBtnYear(new CMFCRibbonButton(ID_EDIT_COPY, _T(""), 14, -1));
pBtnYear->SetKeys(_T("FY"));
pGroupPeriod->AddButton(pBtnYear);
pPanelDisplay->Add(pGroupPeriod);
CMFCRibbonButtonsGroup* pGroupNominal = new CMFCRibbonButtonsGroup();
CMFCRibbonButton* pBtnReal(new CMFCRibbonButton(ID_EDIT_COPY, _T("Real"), 14, -1));
pBtnReal->SetKeys(_T("FR"));
pGroupNominal->AddButton(pBtnReal);
CMFCRibbonButton* pBtnNominal(new CMFCRibbonButton(ID_EDIT_COPY, _T("Nominal"), 14, -1));
pBtnNominal->SetKeys(_T("FN"));
pGroupNominal->AddButton(pBtnNominal);
pPanelDisplay->Add(pGroupNominal);
CMFCRibbonButton* pBtnRatio(new CMFCRibbonButton(ID_EDIT_COPY, _T("Ratio"), 14, 15));
pBtnRatio->SetKeys(_T("FA"));
pPanelDisplay->Add(pBtnRatio);
CMFCRibbonPanel* pPanelUnits = pCategory->AddPanel(_T("Unit settings"), m_PanelImages.ExtractIcon(12));
CMFCRibbonComboBox* pUnitTypeComboBox = new CMFCRibbonComboBox(ID_EDIT_COPY, FALSE, 14, _T("Units:"), 113);
pUnitTypeComboBox->SetKeys(_T("UU"));
pUnitTypeComboBox->AddItem(_T("Imperial"), ID_EDIT_COPY);
pUnitTypeComboBox->AddItem(_T("Metric"), ID_EDIT_COPY);
pUnitTypeComboBox->AddItem(_T("Alternate"), ID_EDIT_COPY);
pUnitTypeComboBox->SelectItem(0);
pPanelUnits->Add(pUnitTypeComboBox);
CMFCRibbonComboBox* pUnitScaleComboBox = new CMFCRibbonComboBox(ID_EDIT_COPY, FALSE, 14, _T("Scale:"), 112);
pUnitScaleComboBox->SetKeys(_T("UC"));
pUnitScaleComboBox->AddItem(_T("Small"), ID_EDIT_COPY);
pUnitScaleComboBox->AddItem(_T("Medium"), ID_EDIT_COPY);
pUnitScaleComboBox->AddItem(_T("Large"), ID_EDIT_COPY);
pUnitScaleComboBox->SelectItem(0);
pPanelUnits->Add(pUnitScaleComboBox);
pPanelUnits->EnableLaunchButton(ID_EDIT_COPY, -1, _T("US"));
CMFCRibbonPanel* pPanelResults = pCategory->AddPanel(_T("Results"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButton* pBtnCalculate(new CMFCRibbonButton(ID_EDIT_COPY, _T("Calculate"), 14, 16));
pBtnCalculate->SetKeys(_T("RC"));
pPanelResults->Add(pBtnCalculate);
CMFCRibbonPanel* pPanelScenarios = pCategory->AddPanel(_T("Scenarios"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButton* pBtnManageScenarios(new CMFCRibbonButton(ID_EDIT_COPY, _T("Manage"), 14, 17));
pBtnManageScenarios->SetKeys(_T("S"));
pPanelScenarios->Add(pBtnManageScenarios);
CMFCRibbonPanel* pPanelProperties = pCategory->AddPanel(_T("Columns and properties"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButton* pBtnAddColumn(new CMFCRibbonButton(ID_EDIT_COPY, _T("Add"), 14, -1));
pBtnAddColumn->SetKeys(_T("PA"));
pPanelProperties->Add(pBtnAddColumn);
CMFCRibbonButton* pBtnEditColumn(new CMFCRibbonButton(ID_EDIT_COPY, _T("Edit"), 14, -1));
pBtnEditColumn->SetKeys(_T("PE"));
pPanelProperties->Add(pBtnEditColumn);
CMFCRibbonButton* pBtnRemoveColumn(new CMFCRibbonButton(ID_EDIT_COPY, _T("Remove"), 14, -1));
pBtnRemoveColumn->SetKeys(_T("PR"));
pPanelProperties->Add(pBtnRemoveColumn);
CMFCRibbonButton* pBtnAddInOptions(new CMFCRibbonButton(ID_EDIT_COPY, _T("Add-in settings"), 14, -1));
pBtnAddInOptions->SetKeys(_T("PO"));
pPanelProperties->Add(pBtnAddInOptions);
CMFCRibbonButton* pBtnDefinition(new CMFCRibbonButton(ID_EDIT_COPY, _T("Definition"), 14, -1));
pBtnDefinition->SetKeys(_T("PD"));
pPanelProperties->Add(pBtnDefinition);
CMFCRibbonButton* pBtnModelHelp(new CMFCRibbonButton(ID_EDIT_COPY, _T("Model help text"), 14, -1));
pBtnModelHelp->SetKeys(_T("PH"));
pPanelProperties->Add(pBtnModelHelp);
CMFCRibbonPanel* pPanelOilInMass = pCategory->AddPanel(_T("Oil in mass"), m_PanelImages.ExtractIcon(12));
CMFCRibbonButton* pBtnMass(new CMFCRibbonButton(ID_EDIT_COPY, _T("Mass measurement"), 14, 13));
pBtnMass->SetKeys(_T("OM"));
pPanelOilInMass->Add(pBtnMass);
CMFCRibbonButton* pBtnVolume(new CMFCRibbonButton(ID_EDIT_COPY, _T("Volume measurement"), 14, 13));
pBtnVolume->SetKeys(_T("OV"));
pPanelOilInMass->Add(pBtnVolume);
|
|
|
|
|
Hi Dale,
Sorry for the delayed response. I am in the office working and participating in the forum part-time as time allows. I have added the code you suggested to the MSOffice2007Demo sample. I am not able to reproduce these cut-off issues you are describing. Would it be possible for you to upload a screenshot so we can see what your talking about?
Actually... I do see a drawing bug here in my office but it is in the "Oil in Mass" Panel. Here on my development box the text is drawing outside of the panel into the non-client area when I resize the window.
Best Wishes,
-David Delaune
|
|
|
|
|
Could this be an XP issue (are you using XP or Vista or Windows7)?
How do u upload an jpeg to the message board?
|
|
|
|
|
Hi Dale,
My main development workstation is Windows7. Give me a few minutes and I will test the binary on Win2k and XP.
Dale Haessel wrote: How do u upload an jpeg to the message board?
The forum does not support embedded images. I would suggest uploading to a free image hosting provider and posting the link here.
http://www.bing.com/search?q=free+image+hosting&src=IE-SearchBox&FORM=IE8SRC[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Thx, here is what I see given my original code from 1st email embedded into MSOffice2007Demo
http://img21.imageshack.us/img21/9932/ribbonl.jpg[^]
Notice how the multiply shows up but not the text to all the other buttons around it. Multiply is larger text than say add so Add should show up if Multiply shows. Any help would be most appreciated. As per everything, this is on XP => if it works on Vista/Windows 7, but not XP that would definitely be worth knowing.
|
|
|
|
|
Hi Dale,
I have tested the modified MSOffice2007Demo binaries on both Win2k and WindowsXP. The panels are drawing the same on all platforms. The only thing that I would classify as being strange... is that in your 'Column operations' pane the first item is 'Multiply' and for some reason this item is the last to be cropped. Even though 'Add' and 'Divide' have a smaller character width.
Is this what you are referring to when you say labels cutting off?
Best Wishes,
-David Delaune
|
|
|
|
|
|
Hi Dale,
Thats exactly the same behavior I see in the MFC Feature Pack Ribbon Panel. I spent a few minutes debugging the issue and was able to track it down to the file:
\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\afxribbonpanel.cpp
And further into the CMFCRibbonPanel::Reposition function. I stopped debugging the issue at this point because it was taking more time than I was willing to invest. You may also be interested in the CMFCRibbonBaseElement::SetCompactMode[^] function. I did not spend the time to check if this function was able to fix the labels. You may want to continue the research.
Good Luck,
-David Delaune
|
|
|
|
|
I have basically the following code
<br />
CMFCRibbonButton* pBtnPeepHelp = new CMFCRibbonButton(ID_HELP2, _T("Peep &Help"), 10, 11, TRUE);<br />
pBtnPeepHelp->SetToolTipText(_T("Peep Help"));<br />
pBtnPeepHelp->SetDescription(_T("Get help using Peep."));<br />
pBtnHelp->AddSubItem(pBtnPeepHelp);<br />
<br />
CMFCRibbonButton* pBtnShowHelp = new CMFCRibbonCheckBox(ID_HELP_SHOWHELPONSTARTUP, _T("Show Help &On Startup"));<br />
pBtnShowHelp->SetToolTipText(_T("Show Help On Startup"));<br />
pBtnShowHelp->SetDescription(_T("Show Help file when starting Peep."));<br />
pBtnPeepHelp->AddSubItem(pBtnShowHelp);<br />
<br />
pMainPanel->Add(pBtnHelp);<br />
When I look at the Customize Quick Access Toolbar->More Commands for the Main Panel, Peep Help shows up twice. I would like to avoid it showing up multiple times.
|
|
|
|
|
Hi Dale,
The only way I am able to duplicate the issue you are describing is by calling CMFCRibbonMainPanel::Add[^] multiple times with the same element pointer. This causes my Quick Access Toolbar to have multiple entries for my test element inside the 'More Commands' customization dialog.
Can you confirm that this line is executing only once? And could you confirm that the pBtnHelp element pointer is only used once?
pMainPanel->Add(pBtnHelp);
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks, however I only call pMainPanel->Add(pBtnHelp); once.
I forgot the following code in my previous snipet that codes above, everything else the same:
<br />
CMFCRibbonButton* pBtnHelp = new CMFCRibbonButton (ID_HELP, _T("&Help"), 10, 11);<br />
pBtnHelp->SetKeys(_T("H"));<br />
pBtnHelp->AddSubItem(new CMFCRibbonLabel(_T("Help")));<br />
It still shows 2 Help in the Quick Access Menu.
|
|
|
|
|
Hi Dale,
I am using the MFC Feature Pack Sample [^]located at:
\Samples\1033\Visual C++ 2008 Feature Pack\RibbonMDI
I pasted the code snippets you have shown into the InitRibbon() function. It compiles cleanly after I added resource definitions. The items only show once for me. I am not able to reproduce the issue you have described.
Best Wishes,
-David Delaune
|
|
|
|
|