routine DATASET.CTRL given DLG.FIELD, DLG.PTR yielding STATUS
''
''    AUTHOR: Steve Bailey
''    CREATED: 2-23-96
''    DESCRIPTION:
''        Control routine for the dialog box which allows the user to set
''        attributes of the chart datasets.
''

define DLG.FIELD as a text variable
define DLG.PTR as a pointer variable
define STATUS as an integer variable

define DATASET.ID, DSOPTION.ID, DSOPTION.VALUE as integer variables
define DSINTERVAL as a real variable
define DSTITLE as a text variable

'' get useful info from the dialog box
'' get attributes of the chart
let DATASET.ID     = DDVAL.A(DFIELD.F("DATASET ID", DLG.PTR))
let DSOPTION.ID    = DDVAL.A(DFIELD.F("DSOPTION ID", DLG.PTR))
let DSOPTION.VALUE = DDVAL.A(DFIELD.F("DSOPTION VALUE", DLG.PTR))
let DSINTERVAL     = DDVAL.A(DFIELD.F("DSINTERVAL", DLG.PTR))
let DSTITLE        = DTVAL.A(DFIELD.F("DSTITLE", DLG.PTR))

let STATUS = 0

'' The order of the selected radio button within the "DSOPTION ID'
'' radio box determines which option will be changed
select case DLG.FIELD
  case "ACCEPT"
    call SET.CHART.DSOPTION.R(CHART.PTR, DSOPTION.ID, DATASET.ID, 
       DSOPTION.VALUE)
    call SET.CHART.DSTITLE.R(CHART.PTR, DATASET.ID, DSTITLE)
    call SET.CHART.DSINTERVAL.R(CHART.PTR, DATASET.ID, DSINTERVAL)
    display CHART.PTR

  case "CLEAR DATASET"
    call CLEAR.CHART.DATASET.R(CHART.PTR, DATASET.ID)
    display CHART.PTR

  case "RETURN"
    let STATUS = 1

  default
endselect

return
end
