AndrewBelt / osdialog

A cross platform wrapper for OS dialogs like file save, open, message boxes, inputs, color picking, etc.
Creative Commons Zero v1.0 Universal
124 stars 21 forks source link

osdialog on windows #1

Closed antoniograzioli closed 6 years ago

antoniograzioli commented 6 years ago

I am creating a sampler module for VCV Rack. On Mac I succesffully created a simple button that opens a "open file" dialog (using osdialog) and loads a wav file in a sampler... The same exact code, compiles correctly on Windows, but doesn't open any "open file" dialog...

here's part of the code:

void OpenWave() {

  char *filename = osdialog_file(OSDIALOG_OPEN, NULL, NULL, NULL);
    if (filename) {
  filepath=filename;

 printf("%s\n", filepath.c_str());
      free(filename);
    }
    else {
      printf("Canceled\n");
    }
   }
AndrewBelt commented 6 years ago

Can you run make ARCH=win and ./test in the osdialog directory? Does it open then?

antoniograzioli commented 6 years ago

i have run make ARCH=win but not "./test".

Yes, "./test" works so it might be something else in the code...I'll check the "trigger" button that uses the OpenWave function.... the strange think is that it works 100% on my mac...compiles on windows but does nothing

AndrewBelt commented 6 years ago

Maybe put a print statement above the call to osdialog to make sure it's being called at all?

Another thing to look out for is that Windows/MSYS2 doesn't flush buffers automatically on newline, so it could be printing but just not flushed. Add a fflush(stdout) at the end maybe?

antoniograzioli commented 6 years ago

it looks like the Schmittrigger buttons are not triggering anything. If i call the OpenWave() void in another place, it simply works as expected.... strange behaviour

AndrewBelt commented 6 years ago

If you can't figure it out, post your code in the Rack repo and I'll take a look.

antoniograzioli commented 6 years ago

OK right, this is not a Osdialog issue...