Correct way of reporting invocation failure?


#1

Hello

I have an “Open audio file” menu entry, triggered by a command, and I made it return “false” when the user tries to open an unsupported (or bogus) file.

However, when doing that, I run into the following assertion, in juce_ApplicationCommandTarget.cpp, line 72 (version 2.0.27) :

jassert (success); // hmm - your target should have been able to perform this command. If it can’t
// do it at the moment for some reason, it should clear the ‘isActive’ flag when it
// returns the command’s info.

I understand the logic behind this, but what should I do in this case ?

It seems to me I have missed something important.

Thanks in advance.

Benjamin


#2

The return value just indicates whether or not you processed the command (which you did). It’s not there to report whether whatever you did was successful or not.


#3

OK. I thought that was somewhat related to the undo stack (and that unsuccessful commands would not be stored inthe stack) but I see there’s another mechanism for that.

Thanks.

BTW in my company, we pay a WHOLE LOT of money for msdn (including support) and managing to get replies to questions I did submit through Microsoft support takes ages… It’s amazing how fast you (and others) reply in this forum. Thanks for the GREAT library and for the support, too !