Jump to content

[app kit] can't understand how to get all file types on Mac OS big sur can I get an example


silageman
 Share

Go to solution Solved by Josh,

Recommended Posts

#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

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

  • Solution

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

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...