/*
 *    SCCS ID: %Z%%M% %I% %E% SST
 *
 *    Copyright (c) 1992 Mark Soloway.  All rights reserved.
 *    See SST_LEGAL_NOTICE file for terms of the license.
 */

#include "NumericInput.h"
#include "TTC.h"

void send_target_handler (UIObject *event_object, UIObject *target_object)
{
  int       mark = tt_mark ();
  Tt_status status;
  TTMessage message ("Accumulate", TT_REQUEST, TT_SESSION, status);

  if (status == TT_OK) {
    int value = event_object->getValue (value);
    status = message.addArg (TT_INOUT, "int", value);

    if (status == TT_OK) {
      TTSession *session = (TTSession *)
                           event_object->getObjectData ("TT_SESSION");
      status = session->sendSynchronousMessage (message);

      if (status == TT_OK) {
        status = message.getArgValue (0, value);

        if (status == TT_OK)
          ((NumericInput *)target_object)->setValue (value);
      }
    }
  }

  tt_release (mark);
}
