routine DLG.CTRL given FIELD, DLG.PTR yielding STATUS
''
''    AUTHOR: Steve Bailey
''    CREATED: 1-20-95
''    DESCRIPTION:
''        Control routine for the dialog box which allows the user to set
''        attributes of the window.
''

define FIELD as a text variable
define DLG.PTR as a pointer variable
define STATUS as an integer variable
define STATUS.TEXT as a 1-dim text array
define PANE.WIDTHS as a 1-dim integer array

'' see which of the predefined actions was taken on the window
select case FIELD
  case "SET POSITION"
    display WIN.PTR at ( DDVAL.A(DFIELD.F("X", DLG.PTR)), 
         DDVAL.A(DFIELD.F("Y", DLG.PTR)))

  case "GET POSITION"
    let DDVAL.A(DFIELD.F("X", DLG.PTR)) = LOCATION.X(WIN.PTR)
    let DDVAL.A(DFIELD.F("Y", DLG.PTR)) = LOCATION.Y(WIN.PTR)
    display DFIELD.F("X", DLG.PTR)
    display DFIELD.F("Y", DLG.PTR)

  case "SET SIZE"
    let DDVAL.A(DFIELD.F("WIDTH", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("WIDTH", DLG.PTR))
    let DDVAL.A(DFIELD.F("HEIGHT", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("HEIGHT", DLG.PTR))
    display WIN.PTR

  case "GET SIZE"
    let DDVAL.A(DFIELD.F("WIDTH", DLG.PTR)) = 
        DDVAL.A(DFIELD.F("WIDTH", WIN.PTR))
    let DDVAL.A(DFIELD.F("HEIGHT", DLG.PTR)) = 
        DDVAL.A(DFIELD.F("HEIGHT", WIN.PTR))
    display DFIELD.F("WIDTH", DLG.PTR)
    display DFIELD.F("HEIGHT", DLG.PTR)

  case "SET TITLE"
    let DTVAL.A(DFIELD.F("TITLE", WIN.PTR)) = 
        DTVAL.A(DFIELD.F("TITLE", DLG.PTR))
    display DFIELD.F("TITLE", WIN.PTR)

  case "SET THUMBS"
    let DDVAL.A(DFIELD.F("HTHUMBPOS", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("HTHUMBPOS", DLG.PTR))
    let DDVAL.A(DFIELD.F("VTHUMBPOS", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("VTHUMBPOS", DLG.PTR))
    let DDVAL.A(DFIELD.F("HTHUMBSIZE", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("HTHUMBSIZE", DLG.PTR))
    let DDVAL.A(DFIELD.F("VTHUMBSIZE", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("VTHUMBSIZE", DLG.PTR))
    display DFIELD.F("HTHUMBSIZE", WIN.PTR)   '' redisplay both scroll thumbs
    display DFIELD.F("VTHUMBSIZE", WIN.PTR)

  case "SET SCROLLABLE"
    let DDVAL.A(DFIELD.F("HSCROLLABLE", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("HSCROLLABLE", DLG.PTR))
    let DDVAL.A(DFIELD.F("VSCROLLABLE", WIN.PTR)) = 
        DDVAL.A(DFIELD.F("VSCROLLABLE", DLG.PTR))
    display WIN.PTR

  case "SET PANEWIDTH"
    reserve PANE.WIDTHS(*) as 4
    let PANE.WIDTHS(1) = DDVAL.A(DFIELD.F("PANEWIDTH1", DLG.PTR))
    let PANE.WIDTHS(2) = DDVAL.A(DFIELD.F("PANEWIDTH2", DLG.PTR))
    let PANE.WIDTHS(3) = DDVAL.A(DFIELD.F("PANEWIDTH3", DLG.PTR))
    let PANE.WIDTHS(4) = DDVAL.A(DFIELD.F("PANEWIDTH4", DLG.PTR))
    let DARY.A(DFIELD.F("PANEWIDTH", WIN.PTR)) = PANE.WIDTHS(*)
    display WIN.PTR

  case "SET STATUSTEXT"
    reserve STATUS.TEXT(*) as 4
    let STATUS.TEXT(1) = DTVAL.A(DFIELD.F("STATUSTEXT1", DLG.PTR))
    let STATUS.TEXT(2) = DTVAL.A(DFIELD.F("STATUSTEXT2", DLG.PTR))
    let STATUS.TEXT(3) = DTVAL.A(DFIELD.F("STATUSTEXT3", DLG.PTR))
    let STATUS.TEXT(4) = DTVAL.A(DFIELD.F("STATUSTEXT4", DLG.PTR))
    let DARY.A(DFIELD.F("STATUSTEXT", WIN.PTR)) = STATUS.TEXT(*)
    display DFIELD.F("STATUSTEXT", WIN.PTR)
        
  case "QUIT", "CLOSE"
    let DLG.PTR = 0
    let STATUS = 1

  default
endselect
return
end
