//---------------------------------------------------------------------------
#include <vcl.h>
#include "DLLForm.h"
#include "DLLMain.h"
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmDLL *frmDLL;

// These are from DLLMain.cpp
void UItoData(FormData *data);
extern DLL_CALLBACK Callback;

__fastcall TfrmDLL::TfrmDLL(TComponent* Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------

// Retrieve the values from the UI components and send them to the EXE.
void TfrmDLL::DoCallback()
{
  FormData data;
  UItoData(&data); // Get the values from the UI components.
  Callback(&data); // The callee must make a copy of the data.
}
//---------------------------------------------------------------------------

void __fastcall TfrmDLL::btnCallbackClick(TObject *Sender)
{
  DoCallback();
}
//---------------------------------------------------------------------------

// Called when any of the radio buttons or check boxes are clicked (changed).
void __fastcall TfrmDLL::UIClick(TObject *Sender)
{
  if (chkAutoCallback->Checked)
    DoCallback();
}
//---------------------------------------------------------------------------

// Called when the spin buttons are clicked.
void __fastcall TfrmDLL::UISpinClick(TObject *Sender, TUDBtnType Button)
{
  if (chkAutoCallback->Checked)
    DoCallback();
}
//---------------------------------------------------------------------------

// Called when any text in the edit boxes is changed.
void __fastcall TfrmDLL::UIChange(TObject *Sender)
{
  if (chkAutoCallback->Checked)
    DoCallback();
}
//---------------------------------------------------------------------------