Rony G. Flatscher, As of: 2001-09-23 (earlier: 99-06-10; 99-07-05)
Click here to see the directory where this file is located in.
    Here is the content of this file:
/****************************************************************************
eurocalc.rc
produced by IBM Object REXX Resource Workshop
*****************************************************************************/
#define input   102
#define MSG2    402
#define MSG1    401
#define DIALOG_1        1
100 DIALOG 31, 36, 268, 218
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Euro-Calculator"
FONT 10, "MS Sans Serif"
{
 EDITTEXT input, 11, 180, 250, 11, WS_BORDER | WS_TABSTOP
 DEFPUSHBUTTON "&Calculate", IDOK, 80, 200, 50, 14
 PUSHBUTTON "&Leave", IDCANCEL, 140, 200, 50, 14
 RTEXT "", 201, 10,  10, 50, 10
 LTEXT "", 301, 70,  11, 50, 9
 RTEXT "", 202, 10,  30, 50, 10
 LTEXT "", 302, 70,  31, 50, 9
 RTEXT "", 203, 10,  50, 50, 10
 LTEXT "", 303, 69,  52, 50, 9
 RTEXT "", 204, 10,  70, 50, 10
 LTEXT "", 304, 70,  71, 50, 9
 RTEXT "", 205, 10,  90, 50, 10
 LTEXT "", 305, 70,  91, 50, 9
 RTEXT "", 206, 10, 110, 50, 10
 LTEXT "", 306, 70, 111, 50, 9
 RTEXT "", 207, 10, 130, 50, 10
 LTEXT "", 307, 70, 131, 50, 9
 RTEXT "", 208, 130,  10, 50, 10
 LTEXT "", 308, 190,  11, 60, 9
 RTEXT "", 209, 130,  30, 50, 10
 LTEXT "", 309, 190,  31, 60, 9
 RTEXT "", 210, 130,  50, 50, 10
 LTEXT "", 310, 190,  51, 60, 9
 RTEXT "", 211, 130,  70, 50, 10
 LTEXT "", 311, 190,  72, 60, 9
 RTEXT "", 212, 130,  90, 50, 10
 LTEXT "", 312, 190,  91, 60, 9
 RTEXT "", 213, 130, 110, 50, 10
 LTEXT "", 313, 190, 111, 60, 9
 CTEXT "", MSG1, 10, 150, 250, 11
 CTEXT "", MSG2, 11, 165, 250, 11
 CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 5, 4, 259, 142
}
The following picture shows how the running program uses this dialog.
 
    Here is a marked-up version of EuroCalc.rex. Code highlighted
    like this was inserted/changed by the author,
    everything else was generated by the OODIALOG "Template Generator" from the
    resource ("rc") file created with the help of the "Resource
    Workshop"
    
/****************************************************************************/
/* Name: EuroCalc.rex                                                       */
/* Type: Object REXX Script using OODialog                                  */
/* Author:                                                                  */
/* Resource: Eurocalc.rc                                                    */
/*                                                                          */
/* Description:                                                             */
/* This file has been created by the Object REXX Workbench OODIALOG         */
/* template generator.                                                      */
/*                                                                          */
/* Copyright (C) ____________________, 1999. All Rights Reserved.           */
/*                                                                          */
/****************************************************************************/
/* Install signal handler to catch error conditions and clean up */
signal on any name CleanUp
MyDialog = .MyDialogClass~new
if MyDialog~InitCode = 0 then do
  rc = MyDialog~Execute("SHOWTOP")
end
/* Add program code here */
exit   /* leave program */
/* ---- signal handler to destroy dialog if error condition was raised  ----*/
CleanUp:
   call ErrorMessage "Error" rc "occurred at line" sigl":" errortext(rc),
                     || "a"x || condition("o")~message
   if MyDialog~IsDialogActive then MyDialog~StopIt
::requires "OODIALOG.CLS"    /* This file contains the OODIALOG classes */
::requires "pgm_07+08-2.cmd" /* RGF, definiert die Euroklasse */
/* ---------------------------- Directives ---------------------------------*/
::class MyDialogClass subclass UserDialog
::method Init
  expose euroList euroDir
  forward class (super) continue /* call parent constructor */
  InitRet = Result
/*
  if self~Load("C:\pgm.rgf\ObjREXX\temp\Eurocalc.rc", ) \= 0 then do
*/
  if self~Load(".\Eurocalc.rc", ) \= 0 then do
     self~InitCode = 1
     return 1
  end
  /* Connect dialog control items to class methods */
  self~ConnectButton(1,"Ok")
  self~ConnectButton(2,"Cancel")
  /* Initial values that are assigned to the object attributes */
  self~INPUT= ''                                     /* Entry Line */
  /* Add your initialization code here */
  euroList = .list~of( "EUR", "ATS", "BEF", "DEM", "FIM", "FRF", "IEP", "ITL",,
                       "LUF", "NLG", "PTE", "ESP", "GRD" )
  euroDir = .directory~new
  euroDir~ATS = .euro ~ NEW("ATS", "Austria",     "Schilling",   13.7603   )
  euroDir~BEF = .euro ~ NEW("BEF", "Belgium",     "Franc",       40.3399   )
  euroDir~DEM = .euro ~ NEW("DEM", "Germany",     "Mark",         1.95583  )
  euroDir~FIM = .euro ~ NEW("FIM", "Finland",     "Mark",         5.94573  )
  euroDir~FRF = .euro ~ NEW("FRF", "France",      "Franc",        6.55957  )
  euroDir~IEP = .euro ~ NEW("IEP", "Ireland",     "Pound",        0.787564 )
  euroDir~ITL = .euro ~ NEW("ITL", "Italy",       "Lira",      1936.27     )
  euroDir~LUF = .euro ~ NEW("LUF", "Luxembourg",  "Franc",       40.3399   )
  euroDir~NLG = .euro ~ NEW("NLG", "Netherlands", "Gulden",       2.20371  )
  euroDir~PTE = .euro ~ NEW("PTE", "Portugal",    "Escudo",     200.482    )
  euroDir~ESP = .euro ~ NEW("ESP", "Spain",       "Peseta",     166.386    )
  euroDir~GRD = .euro ~ NEW("GRD", "Greece",      "Drachmen",   340.750    )
  euroDir~EUR = .euro ~ NEW("EUR", "Europe",      "Euro",         1.0000   )
  return InitRet
::method InitDialog
  expose euroDir euroList
  InitDlgRet = self~InitDialog:super
  /* Initialization Code (e.g. fill list and combo boxes) */
  /* RGF-Show values */
  self~dsp_euro                      /* show present values */
  return InitDlgRet
/* --------------------- message handler -----------------------------------*/
  /* Method Ok is connected to item 1 */
::method Ok
  self~DoTheWork    /* RGF */
/*
  resOK = self~OK:super  /* make sure self~Validate is called and self~InitCode is set to 1 */
  self~Finished = resOK  /* 1 means close dialog, 0 means keep open */
  return resOK
*/
  /* Method Cancel is connected to item 2 */
::method Cancel
  resCancel = self~Cancel:super  /* make sure self~InitCode is set to 2 */
  self~Finished = resCancel      /* 1 means close dialog, 0 means keep open */
  return resCancel
::method DoTheWork
  expose euroDir
  /* parse first three words, translate them into uppercase       */
  PARSE UPPER VALUE self~getValue("input") WITH Amount InputCurrency .
  /* RGF - clear message fields */
  self~rgf_msg("MSG1", center(date("S") time(), 50 ))
  self~rgf_msg("MSG2", LEFT("", 50 ))
  IF Amount = "" THEN      /* nothing given, show exchange rates  */
  DO
    self~set_euro(1)            /* set all euro-objects to one Euro: result is x-change-rate */
    self~rgf_msg("MSG2", "(Exchange rates)" )
    return
  END
  IF DATATYPE(Amount, "Number") = .false THEN
  DO
     self~rgf_msg("MSG2", "InputCurrency not a number!" )
     call beep 500, 10
     RETURN
  END
  IF InputCurrency = "" THEN InputCurrency = "EUR"
  ELSE IF \euroDir~hasindex( InputCurrency ) THEN
  DO
     self~rgf_msg("MSG2", "Unknown currency given!" )
     call beep 500, 10
     RETURN
  END
  tmpEuro = euroDir~entry(InputCurrency)        /* get appropriate euro-object   */
  tmpEuro~betrag=Amount                         /* assign amount, object will calculate euro */
  self~set_euro(tmpEuro~euro_betrag)
::method rgf_msg  /* RGF */
  use arg id, msg
  self~setValue(id, msg)
::method dsp_euro /* RGF - display values */
  expose euroList euroDir
  betrag_id=201; waehrung_id=301        /* ID-Werte */
  DO item OVER euroList
     tmpEuro = euroDir~entry(item)
     IF tmpEuro~euro_betrag = 1 THEN stellen=6  /* rate of exchange ? */
                                ELSE stellen=2
     self~setvalue(betrag_id,   FORMAT( tmpEuro~betrag, , stellen) )    /* auf 2 Nachkommastellen */
     self~setvalue(waehrung_id, tmpEuro~waehrung "["tmpEuro~land"]")
     betrag_id=betrag_id+1; waehrung_id=waehrung_id+1
  END
::method set_euro /* RGF - set euro-value in all euro-objects */
  expose euroDir
  use arg amount
  DO index OVER euroDir
     euroDir[index]~euro_betrag=amount
  END
  self~dsp_euro     /* display present values */
    Here is the content of this file:
/****************************************************************************
eurocalc.rc
produced by IBM Object REXX Resource Workshop
*****************************************************************************/
#define input   102
#define MSG2    402
#define MSG1    401
#define DIALOG_1        1
100 DIALOG 31, 36, 268, 218
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Euro-Calculator"
FONT 10, "MS Sans Serif"
{
 EDITTEXT input, 11, 180, 250, 11, WS_BORDER | WS_TABSTOP
 PUSHBUTTON "&Leave", IDCANCEL, 109, 200, 50, 14
 RTEXT "", 201, 10,  10, 50, 10
 LTEXT "", 301, 70,  11, 50, 9
 RTEXT "", 202, 10,  30, 50, 10
 LTEXT "", 302, 70,  31, 50, 9
 RTEXT "", 203, 10,  50, 50, 10
 LTEXT "", 303, 69,  52, 50, 9
 RTEXT "", 204, 10,  70, 50, 10
 LTEXT "", 304, 70,  71, 50, 9
 RTEXT "", 205, 10,  90, 50, 10
 LTEXT "", 305, 70,  91, 50, 9
 RTEXT "", 206, 10, 110, 50, 10
 LTEXT "", 306, 70, 111, 50, 9
 RTEXT "", 207, 10, 130, 50, 10
 LTEXT "", 307, 70, 131, 50, 9
 RTEXT "", 208, 130,  10, 50, 10
 LTEXT "", 308, 190,  11, 60, 9
 RTEXT "", 209, 130,  30, 50, 10
 LTEXT "", 309, 190,  31, 60, 9
 RTEXT "", 210, 130,  50, 50, 10
 LTEXT "", 310, 190,  51, 60, 9
 RTEXT "", 211, 130,  70, 50, 10
 LTEXT "", 311, 190,  72, 60, 9
 RTEXT "", 212, 130,  90, 50, 10
 LTEXT "", 312, 190,  91, 60, 9
 RTEXT "", 213, 130, 110, 50, 10
 LTEXT "", 313, 190, 111, 60, 9
 CTEXT "", MSG1, 10, 150, 250, 11
 CTEXT "", MSG2, 11, 165, 250, 11
 CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 5, 4, 259, 142
}
The following picture shows how the running program uses this dialog.
 
    Here is a marked-up version of Euro3Calc.rex. Code highlighted
    like this was inserted/changed by the author
    using the above "EuroCalc.rex" as a starting point.
    
/****************************************************************************/
/* Name: EuroCalc.rex                                                       */
/* Type: Object REXX Script using OODialog                                  */
/* Author:                                                                  */
/* Resource: Eurocalc.rc                                                    */
/*                                                                          */
/* Description:                                                             */
/* This file has been created by the Object REXX Workbench OODIALOG         */
/* template generator.                                                      */
/*                                                                          */
/* Copyright (C) ____________________, 1999. All Rights Reserved.           */
/*                                                                          */
/****************************************************************************/
/* Install signal handler to catch error conditions and clean up */
signal on any name CleanUp
MyDialog = .MyDialogClass~new
if MyDialog~InitCode = 0 then do
  rc = MyDialog~Execute("SHOWTOP")
end
/* Add program code here */
exit   /* leave program */
/* ---- signal handler to destroy dialog if error condition was raised  ----*/
CleanUp:
   call ErrorMessage "Error" rc "occurred at line" sigl":" errortext(rc),
                     || "a"x || condition("o")~message
   if MyDialog~IsDialogActive then MyDialog~StopIt
/* RGF
::requires "OODIALOG.CLS"    /* This file contains the OODIALOG classes */
*/
::requires "OODWIN32.CLS"    /* RGF */
::requires "pgm_07+08-2.cmd" /* RGF, definiert die Euroklasse */
/* ---------------------------- Directives ---------------------------------*/
::class MyDialogClass subclass UserDialog inherit AdvancedControls
::method Init
  expose euroList euroDir
  forward class (super) continue /* call parent constructor */
  InitRet = Result
/*
  if self~Load("C:\pgm.rgf\ObjREXX\temp\Euro3calc.rc", ) \= 0 then do
*/
  if self~Load("Euro3calc.rc", ) \= 0 then do
     self~InitCode = 1
     return 1
  end
  /* Connect dialog control items to class methods */
  self~ConnectControl("INPUT","OnInput")
  self~ConnectButton(2,"Cancel")
  /* Initial values that are assigned to the object attributes */
  self~INPUT= ''                                     /* Entry Line */
  /* Add your initialization code here */
  euroList = .list~of( "EUR", "ATS", "BEF", "DEM", "FIM", "FRF", "IEP", "ITL",,
                       "LUF", "NLG", "PTE", "ESP", "GRD" )
  euroDir = .directory~new
  euroDir~ATS = .euro ~ NEW("ATS", "Austria",     "Schilling",   13.7603   )
  euroDir~BEF = .euro ~ NEW("BEF", "Belgium",     "Franc",       40.3399   )
  euroDir~DEM = .euro ~ NEW("DEM", "Germany",     "Mark",         1.95583  )
  euroDir~FIM = .euro ~ NEW("FIM", "Finland",     "Mark",         5.94573  )
  euroDir~FRF = .euro ~ NEW("FRF", "France",      "Franc",        6.55957  )
  euroDir~IEP = .euro ~ NEW("IEP", "Ireland",     "Pound",        0.787564 )
  euroDir~ITL = .euro ~ NEW("ITL", "Italy",       "Lira",      1936.27     )
  euroDir~LUF = .euro ~ NEW("LUF", "Luxembourg",  "Franc",       40.3399   )
  euroDir~NLG = .euro ~ NEW("NLG", "Netherlands", "Gulden",       2.20371  )
  euroDir~PTE = .euro ~ NEW("PTE", "Portugal",    "Escudo",     200.482    )
  euroDir~ESP = .euro ~ NEW("ESP", "Spain",       "Peseta",     166.386    )
  euroDir~GRD = .euro ~ NEW("GRD", "Greece",      "Drachmen",   340.750    )
  euroDir~EUR = .euro ~ NEW("EUR", "Europe",      "Euro",         1.0000   )
  return InitRet
::method InitDialog
  expose euroDir euroList
  InitDlgRet = self~InitDialog:super
  /* Initialization Code (e.g. fill list and combo boxes) */
  /* RGF-Show values */
  self~dsp_euro                      /* show present values */
  return InitDlgRet
/* --------------------- message handler -----------------------------------*/
  /* Method Cancel is connected to item 2 */
::method Cancel
  resCancel = self~Cancel:super  /* make sure self~InitCode is set to 2 */
  self~Finished = resCancel      /* 1 means close dialog, 0 means keep open */
  return resCancel
::method onInput
  self~DoTheWork   /* RGF */
::method DoTheWork
  expose euroDir
  /* parse first three words, translate them into uppercase       */
  PARSE UPPER VALUE self~getValue("input") WITH Amount InputCurrency .
  /* RGF - clear message fields */
  self~rgf_msg("MSG1", center(date("S") time(), 50 ))
  self~rgf_msg("MSG2", LEFT("", 50 ))
  IF Amount = "" THEN      /* nothing given, show exchange rates  */
  DO
    self~set_euro(1)            /* set all euro-objects to one Euro: result is x-change-rate */
    self~rgf_msg("MSG2", "(Exchange rates)" )
    return
  END
  IF DATATYPE(Amount, "Number") = .false THEN
  DO
     self~rgf_msg("MSG2", "InputCurrency not a number!" )
     call beep 500, 10
     RETURN
  END
  IF InputCurrency = "" THEN InputCurrency = "EUR"
  ELSE IF \euroDir~hasindex( InputCurrency ) THEN
  DO
     self~rgf_msg("MSG2", "Unknown currency given!" )
     call beep 200, 10
     RETURN
  END
  tmpEuro = euroDir~entry(InputCurrency)  /* get appropriate euro-object   */
  tmpEuro~betrag=Amount                   /* assign amount, object will calculate euro */
  self~set_euro(tmpEuro~euro_betrag)
::method rgf_msg  /* RGF */
  use arg id, msg
  self~setValue(id, msg)
::method dsp_euro /* RGF - display values */
  expose euroList euroDir
  betrag_id=201; waehrung_id=301        /* ID-Werte */
  DO item OVER euroList
     tmpEuro = euroDir~entry(item)
     IF tmpEuro~euro_betrag = 1 THEN stellen=6  /* rate of exchange ? */
                                ELSE stellen=2
     self~setvalue(betrag_id,   FORMAT( tmpEuro~betrag, , stellen) )    /* auf 2 Nachkommastellen */
     self~setvalue(waehrung_id, tmpEuro~waehrung)
     betrag_id=betrag_id+1; waehrung_id=waehrung_id+1
  END
::method set_euro /* RGF - set euro-value in all euro-objects */
  expose euroDir
  use arg amount
  DO index OVER euroDir
     euroDir[index]~euro_betrag=amount
  END
  self~dsp_euro     /* display present values */