I am having trouble using multiple CMFCEditBrowseCtrl controls in a dialog. There is no problem with only one, but with two or more, the browse button is hidden. If I try using the EnableBrowseButton method, I get a generic browse button with ellipsis, as if it were a custom browse mode; clicking this does nothing. If I try getting the browse mode with GetMode, I find that it is set to None, even though I have explicitly set the browse mode property to File Browse. What is causing this errant behavior?
CMFCEditBrowseCtrl::OnChangeLayout
Redraws the current edit browse control.
try to Use this function
https://github.com/Microsoft/cpp-docs/blob/master/docs/mfc/reference/cmfceditbrowsectrl-class.md
Related
My English is not perfect. I am using Visual C++ 2019 and MFC. At my MDI-program, the menus are compressed: I do not see all the items, there is a double-arrow-like something on bottom of the menu, I always must click to them. I can not disable this. At Resource View, I can not open the whole menu's Properties Page, only for the File, etc. menu's Properties Page. I did not find the disabling on the Properties Page. In the code, in MainFrm.cpp, CBRS_SIZE_DYNAMIC and CBRS_FLYBY occur 2+2 times. I tried to put to comment them, but this did not solve the problem. How can I disable the compression? Thank you.
I can not open Properties Page of the whole menu. Maybe it has not Properties Page, or the cause is the lack of High DPI support in Visual Studio. For example, I can not edit icons: the icon editor is unusable. At the generated program, it seems the High DPI support of toolbar is depend on the style. At WinAPI programs, there are 3 pixel stairs: emulates 1/3 resolution. There is 3*96 dpi = 288 dpi at me, 0,16 mm * 3 = 0,48 mm.
Use CMFCMenuBar::SetShowAllCommands
Remarks
If a menu does not display all the menu commands, it hides the commands that are rarely used.
Whether the application should display all menu items or just the most recently used ones (and the user will have to expand the rest) is an option that can be set by the user: Toolbar Options->Add or Remove Buttons->Customize->Options->Personalized Menus and Toolbars->Menus show recently used commands first. This option is saved in the registry under HKEY_CURRENT_USER\SOFTWARE\CompanyName\ApplicationName\Workspace\MFCToolBarParameters\RecentlyUsedMenus, so the application "remembers" it.
Programmatically it can be changed using the CMFCMenuBar::SetRecentlyUsedMenus() function - it's a static function.
It would be best to let the user decide how the application should work, so I would recommend that you do... nothing about it. Or, you could set it to FALSE, but only for the very first time the application is run. Add a new boolean value in the registry, under ...ApplicationName\Workspace or ...ApplicationName\Settings, with a value always set to TRUE. The best place to do this is the SaveCustomState() member function of your application class. In the LoadCustomState() read that value (default FALSE), and if it is TRUE call CMFCMenuBar::SetRecentlyUsedMenus(FALSE);.
I've been trying to implement a file dialog into my C++ application for a while now, and I achieved good success with the code described in this article (It is german, but the code should be understandable):
https://msdn.microsoft.com/de-de/library/windows/desktop/ff485843(v=vs.85).aspx
However, using this code in my window class, which is a CDialogImpl, I just can't find out how to make this file picker modal. If I use this code, I can just spawn multiple file picker.
Of course, I could just keep track of the state by adding a member variable representing the state, but it would still not solve the problem of being able to click around in the main window while the dialog is opened.
Is there any way which would allow me to make this window modal? I've been trying to scan through all available methods, but I couldn't find anything. I didn't find any flags which could be passed in the creation, neither any options which I could set after creation.
Any help is appreciated!
The example you link to is very simple and has no UI other than the file dialog. Your program is more complex, having a window from which the file dialog is invoked.
You need to provide an owner for the file dialog. When you do that the owner is disabled, part of what makes the dialog modal. Failing to pass an owner means that the other windows are not disabled and so still respond to user input.
The example code provides no owner, but since there are no other windows in that program, that is benign. Modality is only meaningful when there are multiple windows.
So, to solve the problem, pass the owner, the handle of your window, to the Show method of the file dialog.
Disabling owner windows is one of the key parts of a modal dialog. You will find that any API for modal dialogs expects you to specify an owner. Get into the habit of expecting to provide that ownwr window, and looking for the means to do so.
I have a CMFCToolBarComboBoxButton in my dialog. The issue is that I am not able to edit the text field of the combo box by selecting it. I know the box has focus, and I know it is hitting the piece of code where I do a SetText to confirm it.
I also do a EnableWindow(true) before that.
However, when I try and edit the box manually, it does not allow me to. No user input is possible on the box. Some other times, the edit window only gets activated if I actually click on the drop down button. I am not setting the EnableWindow() to FALSEanywhere.
What could be the likely cause?
I have IWebBrowser2 ctrl embedded into my own dialog. I want to simply
display a promo banner within it from my url. How to disable all popup
menu items from the control and force it to open links in new window
(currently when I click on link in the banner, it is being opened
within the same control).
Regards
Dominik
Have a look at the following article:
WebBrowser Customization
I don't know if there is a more convenient way of doing this - but you could always intercept BeforeExplorerNavigate2(), set the out-parameter cancel to true and from there either do a new Navigate() with a different target frame name or open a new window.
As Rob pointed out, there might be problem with filtering out navigate events originating from scripts, see this question.
On main form I have TPageControl and on all of it's tabs I have corresponding Save buttons which are activated on Alt+S combination.
Of course, depending on which tab is opened at the moment, the handler for corresponding Save button should be called; but I get "cannot focus a disabled or invisible window" runtime error if I try to save with Alt+S.
And I've noticed that, the handler of a Save button from the tab which was active before the current tab, is called, but don't know why.
I tried putting Save buttons in panels (it worked fine for some similar problems), but still the same thing happens.
Cheers.
You could do it all with one button. In the OnClick handler, check which page is the current one, and call the saving function for that page.