FileImporter SwiftUI - swiftui

I m experiencing something weird with my File Importer in SwiftUI.
Here is the code I´m using to invoke the file importer :
.fileImporter(isPresented: $showFilePicker, allowedContentTypes: [.data], onCompletion: { result in
print(result)
})
The sheet with the importer shows up. However, it opens by default on "Recents" and I have no menu to navigate?
Image with no Menu
I can make the menu show up if I type something on the search bar and then press the "X" which clears the text, after that the menu will show up.
Menu shows up after clearing search bar
This is the wished style. With the menu. What am I missing?

Related

How to limit the accept file type with directory/png only with SwiftUI drag & drop?

I got a question about drag&drop with SwiftUI. In my case, I added an ondrop modifier to a textfield as the code:.onDrop(of: [.directory], isTargeted: nil) { providers in } , however, when I drag a folder to the textfield, it not works. but if I change the supportedContentTypes to [.fileURL] , it works. same issue with supportedContentTypes of [.png] or[.image] . How can I limit the accept file type with directory/png only?

myComboBox->Dismiss(); not working under wxEVT_TEXT and wxEVT_COMBOBOX_DROPDOWN

My objective:
During wxEVT_COMBOBOX_DROPDOWN load up a choiceDialog and set the choice as combo box value and finally close the combobox using dismiss().
What I tried:
void Class_Scheduler_FNFrame::myComboBoxDropdown(wxCommandEvent& event)
{
SingleChoiceDialog1->ShowModal();
int i = SingleChoiceDialog1->GetSelection();
myComboBox->SetValue(wxString::Format(("%s"), myWxStringArray[i]));
myComboBox->Dismiss();
}
The value got changed but the dismiss(); is not working.
So I tried moving dismiss to wxEVT_TEXT.
void Class_Scheduler_FNFrame::myComboBoxTextUpdated(wxCommandEvent& event)
{
testLabel->SetLabel("This should have worked");
myComboBox->Dismiss();
}
Dismiss() is not working in wxEVT_TEXT as well. But when I type onto the combobox, after triggering wxEVT_COMBOBOX_DROPDOWN, dismiss() is working through wxEVT_TEXT .
Help!
You're trying to do something rather weird: have you ever seen a modal dialog show while the combobox dropdown is opened? I haven't and, generally speaking, there should be only a single modal element shown at each moment.
So why do you have this objective? What is the point of showing the dialog whenever a combobox is opened? It doesn't even seem like you're using it like a combobox at all. Maybe you're actually after some kind of wxFilePickerCtrl-like behaviour, i.e. a small button showing the dialog near a text control? Or maybe you want to use wxComboCtrl instead?
Anyhow, it should be possible to do what you want by postponing showing the dialog using CallAfter(), but I'm almost sure that you actually don't want to do that anyhow.

MFC, Ribbons - CMFCRibbonButton with image: Always show the text

I've got an CMFCRibbonButton that displays a text and an icon. When I compact the ribbon, in the end only the small icon is shown.
Is there a way to tell the button not to get compacted into small icon state, but always show the text as well?
I tried pButton->SetCompactMode(FALSE); without success.
To be sure, CMFCRibbonButton::SetAlwaysLargeImage() is not what you are looking for? I ask, because when only an icon without text is displayed, it is usually the panel the button sits in that has collapsed. See CMFCRibbonPanel::IsCollapsed(). If you want to modify the behavior of the panel so that it won't collape, you could try to subclass CMFCRibbonPanel and play with overrides. The MFC Ribbon is not completely documented but my best bet is CMFCRibbonPanel::IsFixedSize():
class CMyPanel : public CMFCRibbonPanel
{
...
BOOL IsFixedSize() const { return TRUE; }
...
}
If this doesn't work you have to see yourself what happens in NotifyControlCommand or OnUpdateCmdUI when the panel collapses and modify the behavior as needed.

Taking data from a Dialog in Qt and using it in a Ui

So I'm making a text editor using Qt and right now I have a button that opens a dialog called "Format text". I want it to work kind of like the dialog in notepad called "font" where you select a few text attributes from some drop down lists and it shows you what your text will look like. Right now I have it working where you can select the font style, font color, and font size and hit preview and it shows you in a box in the dialog what your text will look like. However, I have a button called "okay" which is supposed to change the highlighted text or the text you are about to type, but I can't figure out how to display those changes on the main window. The .ui files are private and a lot of the already made functions and pointers are the same in every ui file so if I change the ui file to pubic I have to change a whole bunch of things. Can anyway give me a simple answer? I'm trying to do this with as little confusion as possible. More coding and less confusion is better than less coding and more confusion for someone of my skill level. Sorry that this is all one giant paragraph and that I didn't provide any code, but I didn't think the code was necessary, however if you do need some of the code i'd be happy to share it.
Thank you for your help and your time. I hope you all have a nice evening.
QDialog have a signal called finished(), you can connect this signal with your slot. To accomplish your work, pass a QSettings or for simplicity QStringList to dialog settings (responsible for changing font, color ...), the QStringList will save user defined settings, after closing the dialog, iterate through QStringList member to alert Main window.
A pseudo code will look like this
Class Editor:
Editor::Editor()
{
TextSettings textSettings;
textSettings.setSettings(settings); // settings is a member
connect(textSettings, &finished(int)), this, SLOT(alertEditor(int)))
}
Editor::alertEditor(int s)
{
if(s == 0)
{
for (int i = 0; i < settings.size(); ++i)
settings.at(i).toLocal8Bit().constData(); // extract various user settings
}
}
Class TextSettings:
TextSettings::TextSettings(QStringList settings)
{
settings << ui->combobox->currentItem(); // font name as example
}

DSOFramer will not show context menu in Excel 2010

I am embedding Excel in winform using DSOFramer control.
In case of Excel 2010 the context menu on right mouse button click will not open.
It looks as if the control loses focus on right click.
I edited the DsoFramer source code before so I am comfortable with it. Anybody know of any possible hack in order to make this work?
This is what I did:
STDMETHODIMP_(void) CDsoFramerControl::OnCtrlFocusChange(BOOL fCtlGotFocus, HWND hFocusWnd)
{
//TRACE2("CDsoFramerControl::OnCtrlFocusChange(fCtlGotFocus=%d, hwndCurFocus=%x)\n", fCtlGotFocus, hFocusWnd);
// if (!(m_fInFocusChange) && ((fCtlGotFocus) || !IsWindowChild(m_hwnd, hFocusWnd)))
// {
// OnUIFocusChange(fCtlGotFocus);
// }
}