Jules - au contraire - I’ve been doing event-based coding since 1992 (Windows 3.0…) - I’m just not used to it being this easy to do. In the one test Juce app I wrote that has dialogs, I didn’t have to explictly set up and run the MessageManager myself. And so I thought it was some under-the-hood, separate-thread Juce magic. But now I see how it works on the console side - and I consider myself a bit smarter for the experience.
FWIW, here’s my ‘receiver’ code now. It might make a good example for the next person as dumb as me who wanders in. On the ‘sender’ side, I’ll be making a JuceConsoleLogger that derives from Logger - that seems to be the polite thing to do. Ain’t life grand?
[code]// -----------------------------------------------------------------------------
// JuceApp_LogConsole_.cpp
// -----------------------------------------------------------------------------
// JUCE! framework application execution start point for Juce Log Console
// -----------------------------------------------------------------------------
// Who When What
// ---------------- ---------- -----------------------------------------------
// Szinger,MR 2005-07-29 Created
// -----------------------------------------------------------------------------
// © 2005 Martin R. Szinger
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// the action listener is very simple
// -----------------------------------------------------------------------------
class MyActionListener_ : public ActionListener
{
public:
MyActionListener_() {}
virtual ~MyActionListener_() {}
void /* ActionListener:: */ actionListenerCallback(const String &M)
{
if (M.startsWith(“LOG:”)) printf(M.operator const char *() + 4);
}
};
// -----------------------------------------------------------------------------
// Version info
// -----------------------------------------------------------------------------
const String AppName = T(“Juce Log Console”);
const String AppVersion = T(“00.50.2005.0805”);
// -----------------------------------------------------------------------------
// (public, overload) moreThanOneInstanceAllowed
// (public, overload) getApplicationName
// (public, overload) getApplicationVersion
// -----------------------------------------------------------------------------
bool JuceApp_LogConsole_::moreThanOneInstanceAllowed() {return false;}
const String JuceApp_LogConsole_::getApplicationName() {return AppName;}
const String JuceApp_LogConsole_::getApplicationVersion() {return AppVersion;}
// -----------------------------------------------------------------------------
const char *DASHLINE = “----------------------------------------”
"----------------------------------------\n";
// -----------------------------------------------------------------------------
// (public, overload) initialize - the true entry point of the application.
// -----------------------------------------------------------------------------
void JuceApp_LogConsole_::initialise(const String& commandLine)
{
printf(DASHLINE);
printf(“JuceLogConsole: Hello!\n”);
printf(DASHLINE);
MyActionListener_ MyAL;
MessageManager::getInstance()->registerBroadcastListener(&MyAL);
while (MessageManager::getInstance()->dispatchNextMessage() == true) {}
// we never really get here…
MessageManager::getInstance()->deregisterBroadcastListener(&MyAL);
JUCEApplication::quit(true);
}
// -----------------------------------------------------------------------------
// (public, overload) shutdown - the true last chance before exit
// -----------------------------------------------------------------------------
void JuceApp_LogConsole_::shutdown() {}
// -----------------------------------------------------------------------------
// this macro creates wrapper code to actually launch the app properly.
// -----------------------------------------------------------------------------
START_JUCE_APPLICATION (JuceApp_LogConsole_)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// End of file (JuceApp_LogConsole_.cpp)
// -----------------------------------------------------------------------------
[/code]
Thanks for the pointers. It’ll be awhile (we all sincerely hope) before I’m back begging for task bar code help…
Martin Sz.