// Text of project Gauges written on 11/20/95 at 6:21 PM
// Beginning of file Gauge.t

// Before Script for "baseView"
// Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.


baseView :=
    {title: "Gauge test",
     viewBounds: {top: 0, left: 0, right: 240, bottom: 336},
     viewSetupFormScript:
       func()
       begin
       	// resize to fit on all "small" newtons.
       	local b := GetAppParams();
       	constant kMaxWidth := 240;
       	constant kMaxHeight := 336;
       	self.viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
       										  MIN(b.appAreaWidth, kMaxWidth),
       										  MIN(b.appAreaHeight, kMaxHeight));
       end,
     debug: "baseView",
     _proto: @157
    };


// Before Script for "theLabel"
// Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.


theLabel :=
    {text: "Value from Gauge:",
     viewBounds: {left: 18, top: 130, right: 114, bottom: 162},
     debug: "theLabel",
     _proto: @218
    };
AddStepForm(baseView, theLabel);
StepDeclare(baseView, theLabel, 'theLabel);




// Before Script for "theDisplay"
// Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.


theDisplay :=
    {text: "50",
     viewBounds: {left: 122, top: 130, right: 184, bottom: 144},
     viewFormat: 592
     ,
     debug: "theDisplay",
     _proto: @218
    };
AddStepForm(baseView, theDisplay);
StepDeclare(baseView, theDisplay, 'theDisplay);




// Before Script for "theSlider"
// Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.


theSlider :=
    {viewBounds: {left: 18, top: 90, right: 194, bottom: 106},
     minValue: 0,
     maxValue: 100,
     viewValue: 50,
     changedSlider:
       func()
       begin
       	// Show the new gauge values
           SetValue(theDisplay, 'text, NumberStr(viewValue));
           Print("Maxvalue slot = " & maxValue);
       end,
     viewSetupFormScript:
       // required for protoGauge workaround.
       
       func()
       	nil;,
     debug: "theSlider",
     _proto: @212
    };
AddStepForm(baseView, theSlider);
StepDeclare(baseView, theSlider, 'theSlider);




// Before Script for "MaxPicker"
// Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.


MaxPicker :=
    {label: "Max Value:",
     viewBounds: {left: 18, top: 186, right: 138, bottom: 210},
     labelCommands: ["100", "75", "50", "25"],
     textChanged:
       func()
       begin
       	// get the number information and reprogram the gauge again
       	// beware of the dreadful empty string you get when you erase
       	// the old string!
       
       	if NOT StrEqual(text, "") then
           begin
           
           // close the gauge because we want to change min/max slots
           theSlider:Close();  
         
           SetValue(theSlider, 'maxValue, RintToL(StringToNumber(text)));
           
           // open the slider again
           theSlider:Open();
           end
       end,
     entryFlags: 10753,
     text: "100",
     debug: "MaxPicker",
     _proto: @189
    };
AddStepForm(baseView, MaxPicker);
StepDeclare(baseView, MaxPicker, 'MaxPicker);




// Before Script for "infoLabel"
// Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.


infoLabel :=
    {
     text:
       "This sample shows how to make use of protoGauges, get values and also dynamically set the min and max boundaries."
     ,
     viewBounds: {left: 26, top: 26, right: 218, bottom: 66},
     viewJustify: 0,
     debug: "infoLabel",
     _proto: @218
    };
AddStepForm(baseView, infoLabel);




constant |layout_Gauge.t| := baseView;
// End of file Gauge.t



