Customizing CMFCRibbonBar im MFC - c++

I am trying to customize the default MFC RibbonBar. I need to reduce its height, change its color etc, but so far i haven't found anything on how to do so. I've been to msdn, and they just tell you how to add new controls on the ribbon.Can any one please point me in the right direction? Is this ribbon control even customize-able? i mean apart from adding categories and other controls on it, i want to change the look of the ribbon.
Some code samples about how to work with MFCRibbonControl would be of great help too.

Related

How to set font in edit box part of a CMFCToolBarComboBoxButton?

I'm able to set the font used to draw the drop-down part of a CMFCToolBarComboBoxButton combo box which is embedded in a CMFCToolBar toolbar. However, I'm not able to set/change the font used for the edit field control which is part of the combo box. I.e., when the combo box is collapsed the currently selected item is always drawn with the standard/default font no matter what font is used for the entries when expanding the box.
I successfully change the font of the drop down box part by using a pointer to the underlying CComboBox object retrieved via CMFCToolBarComboBoxButton::GetComboBox() (and then via CComboBox::SetFont(...)). But when using the method CMFCToolBarComboBoxButton::GetEditCtrl() to obtain a pointer to the edit control part (in order to change its font, too) this method always returns a nulltpr. Does anybody know why or more importantly: What is the correct way to set the font used for the edit control part of the box?
I've searched the web now quite a lot but cannot find a solution to the problem. Thanks for any advice!
Additional note: I need to change the used font(s) at run time in my MFC application.
OK, I finally came to the conclusion that it's better to leave these fonts up to the OS settings anyway and not explicitly set them by the application code.
This is not a technically correct answer to the (my own) question, certainly, but may be a good advide for others chasing the same problem.

Qt QCombobox popup inconsistent position

I have searched far and wide and cannot find anything online about my issue even though it seems rather trivial, and i feel like there's just something I'm missing, so I apologise if the answer is apparent.
However, when I use a QComboBox in Qt, When I click on it instead of dropping down like I want it to, it shows the popup with the current selected item as the origin. If that doesn't make sense this is what I am referring to:
It shows the popup starting at the current selected item where the button is. I just want it to drop downwards like any other normal combobox! How can i Achieve this? If i make it editable it drops down exactly how i want it, but i don't want it to be editable!
Does anyone know what's up?
Edit:
I am running Windows 10

Qt - How to create extra roles for a QDialogButtonBox

I apologize in advance for not having more code to show, this is more of a conceptual question. I am working in Qt 4.7 and I have a QDialogButtonBox in my UI to which I need to add several custom buttons*. I set the buttons up like I normally would. For example, if I'm adding a Save button, I would create it like this:
QPushButton *myButton = new QPushButton(tr("Save"));
Usually I could just add this to my UI as is. However, I've found with the button box, it needs to have a "ButtonRole" attached, which are built-in to Qt. The only role that seems close to matching what I want is "ActionRole", but that's still sort of vague as to it's meaning when looking at it later in the code. I know theoretically any of the roles could be associated with this button, but it seems like really bad practice to me to attach an unrelated-named role like "RejectRole" or "HelpRole" to it just to make it work. My question is, how can I create a new role, something like "SaveRole", that I can use for this button? I tried putting a line like #define SaveRole (some int value) in my code and using that since the ButtonRoles are enumerators, but that gave me an error saying it couldn't convert the parameters. I know there's also NRoles in ButtonRole, and it seems like that can probably be used to create new Roles, but I've been searching for about a half hour and am finding it EXTREMELY difficult to find any information on how to use this. If anyone has suggestions it would be greatly appreciated. Thanks!
*For the record, I know how easy it would be to avoid this problem by using QPushButtons individually instead of a QDialogButtonBox, but my project head wants the button box used, so unfortunately I don't have that option.
EDIT: I forgot to mention before but it may be worth bringing up, this button box is pretty large, and all the built-in roles are already in use.

CTreeCtrl - only use checkboxes for certain rows/children

I have a CTreeCtrl and I filled it with content. Now I wanted to add checkboxes but JUST for certain ones. I've found the possibilty to activate checkboxes on the TreeCtrl with m_Tree.ModifyStyle(0, TVS_CHECKBOXES), but this adds a checkbox on each node/child on the whole Ctrl. Is it possible to turn this feature on, but just for certain ones?
All I found is the possibility to add three different pictures, catch the clickevent on a node and change the image. Is there an easier way? Let me know.
Thanks a lot,
jntme
I don't think that CTreeCtrl provide any method to add check boxes at specified node only.
Easiest way to do this is explain in following link.
http://www.tech-archive.net/Archive/VC/microsoft.public.vc.mfc/2005-10/msg00454.html.
please go through and let me know if you are facing problem.
You may be able to accomplish what you want with a custom draw tree control. But, you'll need to render the image states yourself. That could get messy because you'll need to account for all of the possible different states.

How can I visually design a component in C++ Builder?

I have been away from C++ for a couple of years now doing AS3/Flex work. I have gotten used to being able to create a component and place it in design mode with very little fuss and I am struggling to get my head around the C++ Builder way of doing the same thing.
I have written many components for C++ Builder in the past, but none of them have been visual. What I would like to do now is create a component for customer search and another for order processing because I want to be able to create a new instance of these on the fly. What I don't want to do is have to place each of the components like the dbgrid and search fields manually in code. I would like to do this (as well as set their properties) in design mode.
How do I go about this? I have browsed the source for other Delphi components and I notice they have dfm files which seems to be what I need. How do I do this in C++ Builder? The only option I see is to add a new form if I want a dfm, but this isn't what I want as my components will be based on TPanel.
Is there a way to do this or do I have to resort to doing it all in code with no visual reference?
Pursuing the DFM idea I did a test this morning where I created a component based on TPanel and added a new form to it which I create and parent in the constructor of the component. In design mode I set the form border to none and placed a grid on it. This all looks OK until I place the component in my application, at that point it looks like a panel with a standard looking form in it and the grid is missing. If I run the app the panel shows as expected, borderless and with a grid. The DFM appears to be ignored in design mode for some reason.
If you know a better way to do this than using components then please give me some pointers.
Any help and advice will be appreciated beyond words
You might want to have a look at frames (look for "Frame objects"). They are "subforms" you can design visually and then place on forms.
Just as an FYI item, you can also drop the panel on a form, put any other controls on it, position them, set captions, etc..
Now, click the panel to select it, and use Component->Create Component Template from the IDE's main menu. This creates a unit you can install as a component which will add the panel and it's sub-controls (as a single component) to the IDE's component palette.
Of course, you can then modify the source for that new component like any other component source.