Search code examples
mfc

MFC - How can I add a spin control to a ribbonbar


I'm using a ribbon style application and I can't seem to find a way to add a spin control to my ribbonbar. In the list of controls of my toolbox there seems to be a spinEdit control but when I add it to the ribbon bar it looks like a ribbonEdit control without showing the up and down buttons that are supposed to be embedded with it. It's there a way to enable this control to behave like a spinEdit or does this control not work at all? Thanks in advance.


Solution

  • Call EnableSpinButtons() on the edit control - http://msdn.microsoft.com/en-us/library/vstudio/bb982261.aspx . Instantiate it like this:

    CMFCRibbonEdit* edit = new CMFCRibbonEdit(ID_SOME_ID, 75);
    edit->EnableSpinButtons(10, 20);
    pPanel->Add(edit);