silageman Posted November 7, 2021 Share Posted November 7, 2021 (edited) https://www.ultraengine.com/learn/CPP/RequestFile the documentation is not great here am trying to pass in a file any file so I can convert with FFmpeg just need an example of request file that will accept any file extension on Mac OS big sur. thanks Edited November 7, 2021 by silageman added screen grab Link to comment Share on other sites More sharing options...
Josh Posted November 7, 2021 Share Posted November 7, 2021 The default value for the file filter parameter should accept all files: All Files:* Are the files in the screenshot not selectable? My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
silageman Posted November 7, 2021 Author Share Posted November 7, 2021 No josh only folders are selectable in the screenshot why is this? 1 Link to comment Share on other sites More sharing options...
Josh Posted November 7, 2021 Share Posted November 7, 2021 Checking.... My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
silageman Posted November 7, 2021 Author Share Posted November 7, 2021 #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); //Create User Interface auto ui = CreateInterface(window); //Create buttons int x = (window->ClientSize().x - 120) / 2; int y = 350; int sep = 0; auto button = CreateButton("CONVERT", x, y, 300, 60, ui->root); y += sep; while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if (ev.source->As<Widget>()->text == "CONVERT") { WString file = RequestFile("Open File", "", "All Files:*", 0, false); Print(file); return 0; //Print(Command("./ffmpeg -h")); } break; case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } here just to make easier, latest Xcode and app kit from the App Store on big sur. it's hardly a permission thing? Link to comment Share on other sites More sharing options...
Josh Posted November 7, 2021 Share Posted November 7, 2021 So far I am unable to find any mention of asterisks / wildcard characters in the NSOpenPanel file types. It may be that Cocoa requires you to explicitly specify what file types are allowed. Do you know the specific file types your application should support? My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted November 7, 2021 Solution Share Posted November 7, 2021 Okay, it appears that asterisk wild cards are not supported, at least I can't find any mention of them. It's not a perfect solution, but I programmed a special case when just one file extension is specified using an asterisk character (the default setting). When this occurs the requester will allow any file extension. This change will be included in the next update. Until then, I would explicitly specify each file format your application supports (which is probably the better approach anyways). My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
silageman Posted November 7, 2021 Author Share Posted November 7, 2021 ok thanks. Quote WString file = RequestFile("Open File", "", "TEXT FILES(*.txt):txt", 0, false); Quote Quote Link to comment Share on other sites More sharing options...
Recommended Posts