user interface - wxWidgets Commandline / GUI Hybrid Application Fails to Get Dialog Input -
i have command-line application written in c++ , built gcc/make runs on macos. application not have own gui , not supposed have root windows -- it's console app meant controlled application.
however, there need show file selection dialog @ 1 point, makes bit of hybrid.
i've used wxwidgets create dialog, fails input. i've seen in various faqs , user groups bundle required. when tried create bundle didn't solve problem.
here's how wxwidgets initialized:
#ifdef __wxmac__ if (!wxentrystart(argc, argv)) { cout << "failed initialize wxwidgets." << endl; return 0; } #endif clientapp = new mainclass(); clientapp->run(argc, argv); #ifdef __wxmac__ wxentrycleanup(); #endif when try show browse file dialog, using code, shows file chooser not respond, acting has no message pump:
#ifdef __wxmac__ wxfiledialog* dlg = new wxfiledialog( null, _("upload file"), _(""), _(""), _("all files (*.*)|*.*"), wxfd_open|wxfd_file_must_exist ); if (dlg->showmodal() == wxid_cancel ) { infolog("file upload dialog has been cancelled." << endl ) return false; } #endif since faqs creating bundle way automagically create message pump , make gui responsive. tried creating bundle:
myapp.app --> contents --> macos --> myapp (executable file) --> cert.crt (ssl certificate used app) --> resources --> myapp.icns --> info.plist (points ot myapp executable , uses myapp.icns icon)
the application controlling not 1 have control on , has run in way:
myapp
the controlling app needs read console output of app , why has been console-only app.
since executable few directories deeper, tried creating shell script in root directory above bundle run application , calling myapp. myapp runs myapp.app/contents/macos/myapp, forwarding commandline parameters.
this didn't work. browse file window created , sits there, giving me rainbow spinwheel every time mouse on it.
what can message pump going? there call can add wxwidgets code or need differnently bundle? having shell script launch app inside bundle defeat "message pump magic" bundle supposed give, , if so, there sensible workaround? need create sort of pseudo-parent wxfiledialog?
i've heard reports alternative creating application bundle use following code (which never recommend on bundle, sounds situation reason use it):
#include <applicationservices/applicationservices.h> processserialnumber psn; getcurrentprocess(&psn); transformprocesstype(&psn,kprocesstransformtoforegroundapplication); this of course platform specific, wrap accordingly.
do have derived wxapp, , wxapp::oninit()? these still required initialize event loop.
Comments
Post a Comment