Matrix Elements VB-800 Instrukcja Użytkownika Strona 23

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 172
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 22
A1.5 Adding a user-friendly interface with Visual C
++
15
..............................................ox/dev/windows/ranapp/RanApp.ox
#include <oxstd.h>
#include <oxdraw.h>
GetRanAppSettings(const acT, const acN, const acAcf);
static decl s_mX;
static decl s_cT = 30;
static decl s_cN = 2;
static decl s_cAcf = 4;
OnDimension()
{
if (GetRanAppSettings(&s_cT, &s_cN, &s_cAcf))
println("T = ", s_cT, " n = ", s_cN,
" lag length = ", s_cAcf);
}
OnGenerate()
{
s_mX = rann(s_cT, s_cN);
}
OnVariance()
{
print( variance(s_mX) );
}
OnDraw()
{
DrawCorrelogram(0, s_mX[][0]’, "ran1", s_cAcf);
DrawSpectrum(1, s_mX[][0]’, "ran1", s_cAcf);
ShowDrawWindow();
}
.......................................................................................
Eventough GetRanAppSettings() is defined, it still has to be declared.
OnDimension() calls GetRanAppSettings() to get new values, printing the
new settings if successful. The arguments are passed as references so that they
may be changed. The C
++
code is:
.........................................................................
extern "C" void OXCALL FnGetRanAppSettings(
OxVALUE *rtn, OxVALUE *pv, int cArg)
{
CRanDimDlg dlg;
OxLibCheckType(OX_ARRAY, pv, 0, 2);
OxLibCheckType(OX_INT, OxArray(pv, 0), 0, 0);
OxLibCheckType(OX_INT, OxArray(pv, 1), 0, 0);
OxLibCheckType(OX_INT, OxArray(pv, 2), 0, 0);
// initialize dialog with current settings
dlg.m_cT = OxInt(OxArray(pv, 0), 0);
dlg.m_cDim = OxInt(OxArray(pv, 1), 0);
Przeglądanie stron 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 171 172

Komentarze do niniejszej Instrukcji

Brak uwag