#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCdialog.h>
#include <WSCvifield.h>
#include <WSCradioGroup.h>
#include <WSCmessageDialog.h>
extern WSCvifield* newvifi_003;
extern WSCradioGroup* newradi_006;

void dialogep(WSCbase* object){
  WSCdialog* dialog = (WSCdialog*)object->cast("WSCdialog");
  if (dialog == NULL){
    return;
  }
  if (dialog->getStatus() != WS_DIALOG_OK){
    object->setVisible(False);
    return;
  }
  
  WSCstring str;
  str = newvifi_003->getProperty(WSNlabelString);
  if (!strcmp((char*)str,"")){
    WSCmessageDialog* msg = WSGIappMessageDialog();
    msg->setProperty(WSNdefaultPosition,True);
    msg->setProperty(WSNwidth,500);
    msg->setProperty(WSNlabelString,"Please input some string to the input field.");
    msg->popup();
    return;
  }
  long val = newradi_006->getProperty(WSNvalue);
  if (val == 0){
    WSCmessageDialog* msg = WSGIappMessageDialog();
    msg->setProperty(WSNdefaultPosition,True);
    msg->setProperty(WSNwidth,500);
    msg->setProperty(WSNlabelString,"Please select a item of the radio group.");
    msg->popup();
    return;
  }
  object->setVisible(False);
}
static WSCfunctionRegister  op("dialogep",(void*)dialogep);
