| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- MODULE Demo1;
- (*
- * REPERTOIRE
- * Release 1.6
- * By Charles Bradford and Cole Brecheen
- * (c) Copyright 1985-1990 PMI
- * Green Bay, WI
- * All rights reserved
- * (414) 468-6040
- *)
- IMPORT ControlUtils;
- IMPORT DspFiles;
- IMPORT ErrorManager;
- IMPORT FramePainter;
- IMPORT InputManager;
- IMPORT NdxBones;
- IMPORT NdxFiles;
- IMPORT NdxTypes;
- IMPORT PosUtils;
- IMPORT Scrn2Ndx;
- IMPORT ScrnTypes;
- IMPORT ScrnUtl1;
- IMPORT ScrnUtl2;
- IMPORT VWindows;
- IMPORT WindowPrims;
- VAR
- NdxFile: NdxTypes.NdxFileType;
- FrameVar: ScrnTypes.DisplayFrame;
- ScreenFile: ScrnTypes.DisplayFile;
- NextFrame: ScrnTypes.AFrameName;
- RecName: ARRAY [0..19] OF CHAR;
- SavedHeight: CARDINAL;
- BEGIN
- SavedHeight := VWindows.GetCursorHeight(
- VWindows.CurrentWindow );
- IF NOT NdxBones.OpenNdxFile( NdxFile, 'demo1.ndx' ) THEN
- (*If the file doesn't exist, create it.*)
- NdxFiles.CreateNdxFile( NdxFile, 'demo1.ndx',
- 'RecName, age, job' );
- END;
- IF NOT DspFiles.OpenDisplayFile( ScreenFile, 'demo1.dsp' ) THEN
- ErrorManager.WARN( 'Could not open DEMO1.DSP' );
- RETURN;
- END;
- ScrnTypes.InitDisplayFrame( FrameVar, VWindows.CurrentWindow );
- REPEAT
- NextFrame := 'NameScrn';
- ControlUtils.ReadShowAndCntrl( ScreenFile, FrameVar, NextFrame );
- (*This will always display the screen that says
- "Enter a record name."*)
- IF NOT PosUtils.Equal( NextFrame, ScrnTypes.ProgramExit ) THEN
- ScrnUtl1.GetFieldText( FrameVar,
- FrameVar^.CurrentField, RecName );
- DspFiles.ReadDisplayFrame( ScreenFile, FrameVar, 'EntryScreen' );
- IF NOT Scrn2Ndx.FillScr( NdxFile, FrameVar, RecName, '') THEN
- ControlUtils.ChangeField( FrameVar, RecName, 'RecName', TRUE );
- END;
- FramePainter.ShowDisplayFrame( FrameVar, 0, 0, 0, 0 );
- InputManager.ControlFrame( FrameVar, 0, '', FALSE, NextFrame );
- IF PosUtils.Equal( NextFrame, FrameVar^.normlnext ) THEN
- IF NOT Scrn2Ndx.PutScrRec(NdxFile, FrameVar, RecName,'')
- THEN HALT(); END;
- IF NOT NdxFiles.WriteRecord( NdxFile, RecName )
- THEN HALT(); END;
- END;
- END;
- UNTIL PosUtils.Equal( NextFrame, ScrnTypes.ProgramExit );
- ScrnUtl2.CloseDisplayFrame( FrameVar );
- NdxFiles.CloseNdxFile( NdxFile );
- VWindows.ClearPart( VWindows.CurrentWindow, 0, 0,
- VWindows.EndCol(VWindows.CurrentWindow),
- VWindows.EndRow(VWindows.CurrentWindow) );
- VWindows.SetCursorHeight( VWindows.CurrentWindow, SavedHeight );
- END Demo1.
|