home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 7891 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  2.2 KB

  1. Path: sparky!uunet!mcsun!sun4nl!wtrlnd!contrast!postmaster
  2. From: berend@contrast.wlink.nl (Berend de Boer)
  3. Newsgroups: comp.lang.pascal
  4. Subject: tvquestion
  5. Message-ID: <726229326.AA01017@contrast.wlink.nl>
  6. Date: Tue, 05 Jan 1993 09:54:42
  7. Sender: postmaster@contrast.wlink.nl
  8. Lines: 82
  9.  
  10.  AN> Hi,
  11.  AN>    my name Mark Nowinski I was wondering how I can put my
  12.  AN> program into Turbo Vision. (Program listed below)
  13.  
  14.  AN> Program Convert;
  15.  AN> Uses CRT;
  16.  AN> const
  17.  AN>     intercept = 32.0;
  18.  AN>     slope = 1.8;
  19.  AN> Var
  20.  AN>   fahrenheit, celsius : real;
  21.  AN> begin
  22.  AN> ClrScr;
  23.  AN>      write('Enter the degrees in Celsius: ');
  24.  AN>      readln(celsius);
  25.  AN>      fahrenheit := intercept + celsius * slope;
  26.  AN>      writeln('That is equal to ',fahrenheit:3:0,' degrees
  27.  AN> F'); repeat until keypressed;
  28.  AN> ClrScr;
  29.  AN> end.
  30.  
  31. program Demo;
  32. uses Objects, Views, Dialogs, App;
  33. const
  34.   intercept = 32.0;
  35.   slope = 1.8;
  36. var
  37.   MyApp : TApplication;
  38.   Dialog : PDialog;
  39.   R : TRect;
  40.   s : string;
  41.   P : PView;
  42.   fahrenheit, celsius : real;
  43.   code : word;
  44.   Result : word;
  45. begin
  46.   MyApp.Init;
  47.   R.Assign(20,6, 58,16);
  48.   Dialog := New(PDialog, Init(R, 'Celsius'));
  49.   with Dialog^ do  begin
  50.     R.Assign(2,2, 30,3);
  51.     Insert(New(PStaticText, Init(R, 'Enter the degrees in Celsius')));
  52.     R.Assign(2,3, 19,4);
  53.     P := New(PInputLine, Init(R, 15));
  54.     Insert(P);
  55.     R.Assign(14,7, 24,9);
  56.     P := New(PButton, Init(R, 'O~K~', cmOK, bfDefault));
  57.     Insert(P);
  58.     SelectNext(FALSE);
  59.   end;  { of with }
  60.   Result := MyApp.ExecView(Dialog);
  61.   Dialog^.GetData(s);
  62.   Val(s, celsius, code);
  63.   fahrenheit := intercept + celsius * slope;
  64.   Val(fahrenheit:3:0, s);
  65.   R.Assign(20,6, 58,16);
  66.   Dialog := New(PDialog, Init(R, 'Fahrenheit'));
  67.   with Dialog^ do  begin
  68.     R.Assign(2,2, 30,3);
  69.     Insert(New(PStaticText, Init(R, 'That is equal to ' + s + ' degrees
  70. F')));
  71.     R.Assign(14,7, 24,9);
  72.     P := New(PButton, Init(R, 'O~K~', cmOK, bfDefault));
  73.     Insert(P);
  74.   end;  { of with }
  75.   Result := MyApp.ExecView(Dialog);
  76.   MyApp.Done;
  77. end.
  78.  
  79.  
  80.  AN> I would appreciate if someone wrote a short demo program.
  81.  
  82. Maybe this can help you. I do not know if it works, it is entered by
  83. head but it should give you at least an idea.
  84.  
  85.  
  86. Groetjes,
  87.  
  88. Berend. (-:
  89. fido: 2:281/527.23
  90. email: berend@contrast.wlink.nl
  91.  
  92.