I've derived a class from CStatic in MFC. But I don't know how to add it to my dialog window.
This mfc application that I'm working on is a dialog based application.
In Gtk+ or Qt we could use layouts and add our widgets to them, but in mfc it doesn't seem to be such a mechanism. I'm wondering how is it possible for an custom made control to be added to another GUI element!!!
Please give me a simple example if you can.
thank you
I think the technique you are looking for is subclassing (MSDN).
There is a good sample on that page too.
Related
I want to achieve something like this
Is it possible in MFC? If yes, what is the ideal way?
Yes, it is. I was demanded to do it and now have an application displaying a menu and a ribbon. In my case my main window class is derived from CFrameWndEx and it has a CMFCMenuBar member and a CMFCRibbonBar.
But I agree with #Michael Walz it is a strange interface.
The rest of the work, is your job to investigate...
BTW, the ribbon on your picture does not seem to be really a ribbon as it has no tabs on its top. Is really a ribbon you want, or are you speaking about a toolbar?
I am quite new in JavaFX and I have a question about the design. I am creating my main menu in FXML using Scene Builder. I have various menu buttons and each of these have a sub-menu. These sub-menu options will open new windows. Is it possible to declare these submenu choices so they do not dissapear after I click on them? If so, can I declare it in my fxml or I have to do it programatically?
Also, is it possible to detach it from the menu button? I would like to have my menu choices around 1 cm away from the menu button itself.
Thank you
Suggested Alternate Solution
If you want more flexibility in positioning a popup menu after a button click as well as fine control over when the menu shows and hides, try using a Button + a ContextMenu rather than a MenuButton.
The relevant methods are:
contextMenu.show(anchorNode, side, dx, dy)
contextMenu.hide()
There is sample code for triggering a context menu on a button press button in the ContextMenu javadoc.
You might also need to monitor the context menu's showingProperty and in a listener show the menu again if the JavaFX system has decided to try and hide it after some user action and you still want the menu visible.
Answers to additional unrelated comments
OK It sounds logical, yet since Im not really good in JavaFX yet, your Idea is quite challenging.
It's not that hard to implement, but from your subsequent comments it sounds like it's probably not the user interface you want for your users anyway (which makes sense to me because the interface you describe in your question seems a little strange).
I thought If it would be easier to have a static xml that have various menu choices, lets say aligned to the right and then whenever I click one of the choices, a new FXML would be loaded in the middle of the screen holding buttons for a submenu?
That seems logical. Sounds like a JavaFX version of a traditional web page layout with a navigation menu on the side controlling a content pane in the center.
A Java only version of that is: How to have menus in java desktop application. You could adapt that to a FXML based version without too much difficulty.
You might also be interested in Managing Multiple Screens in JavaFX.
Also, any tutorial for beginners would be greatly appreciated. These Oracle ones dont make too much sense for me
If you are beginning JavaFX, I recommend using just the Java API portions of JavaFX until you become familiar with them, and then use FXML only after you are comfortable with the Java API.
Personally, I think the Oracle JavaFX Tutorials are excellent. The difficulty for beginners is that the tutorials are also part reference material, which complicates portions of them (especially the deployment related pieces).
If you prefer a different tutorial style see:
Makery JavaFX tutorial (good for beginners)
zenjava tutorials (more advanced)
I am working on a very large MFC application. There are hundreds of dialogues in this application. Now, I want to change the Background color and Font size of all dialogues in MFC application. How can I do this? Whether I have to handle WM_CTLCOLOR massage for each and every dialogue or any other work around?
Note: I can not use any library like BCGSoft, Xtreme Toolkit.
Create a Dialog class and handle WM_CTLCOLOR massage in that class, Now derive every other Dialog of your MFC application from this class.
Is there an easy way to change the shape of a button in a form?
There could be other ways, but if you are not using WPF, you can use Images for buttons.
If you are using WPF, there are lots of options you can explore.
This might be a bit old, but may point the way, look at ownerdraw properties and styles and messages. http://msdn.microsoft.com/en-us/library/ms364048(v=vs.80).aspx
As an aside why would you want to change the shape of the button. Bear in mind your users, they more than likely don't like change.
You are referring to Ownerdraw buttons. The following links shall help you.
http://www.codeproject.com/KB/buttons/roundbuttons.aspx
how to create a round/circular button in win32 API using visual c++
I've a PyQt4 Installed on Python 2.6. I wish to insert actions or widgets into a toolbar in QtDesigner instead of adding them in code, with addAction or addWidget (as simple as adding actions to a menu in design time).
You can add actions by dragging them to your tool bar from the "Action editor" dock window. You cannot add widgets to the tool bar in Qt Designer, I'm afraid you'll have to do this from your code.
You can create your own widget plugins with new or extended functionalities.
Just follow the definition rules from the documentation .
I use a lot of custom widgets inside the Qt Designer.
Once you have figured out, how it works, it becomes a really power full method for your design work flow inside Qt Designer.