home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / apdtr.zip / FLOWPARM.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-25  |  2KB  |  87 lines

  1. unit Flowparm;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, AdPort, TComIni;
  8.  
  9. type
  10.   TFlowControlForm = class(TForm)
  11.     HardwareFlowGroup: TRadioGroup;
  12.     SoftwareFlowGroup: TGroupBox;
  13.     ReceiveFlowBox: TCheckBox;
  14.     TransmitFlowBox: TCheckBox;
  15.     Label1: TLabel;
  16.     Label2: TLabel;
  17.     XonCharEdit: TEdit;
  18.     XoffCharEdit: TEdit;
  19.     OkBtn: TBitBtn;
  20.     CancelBtn: TBitBtn;
  21.     HelpBtn: TBitBtn;
  22.     procedure OkBtnClick(Sender: TObject);
  23.  
  24.   public
  25.     constructor Create(AOwner : TComponent); override;
  26.   end;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. constructor TFlowControlForm.Create(AOwner : TComponent);
  33. begin
  34.   inherited Create(AOwner);
  35.  
  36.   {set default values}
  37.   if (hwfUseRTS in HdwFlow) or (hwfRequireCTS in HdwFlow) then
  38.     HardwareFlowGroup.ItemIndex := 2
  39.   else if (hwfUseDTR in HdwFlow) or (hwfRequireDSR in HdwFlow) then
  40.     HardwareFlowGroup.ItemIndex := 1
  41.   else
  42.     HardwareFlowGroup.ItemIndex := 0;
  43.  
  44.   case SfwFlow of
  45.     swfReceive : ReceiveFlowBox.Checked  := True;
  46.     swfTransmit: TransmitFlowBox.Checked := True;
  47.     swfBoth    :
  48.       begin
  49.         ReceiveFlowBox.Checked  := True;
  50.         TransmitFlowBox.Checked := True;
  51.       end;
  52.   end;
  53.  
  54.   XonCharEdit.Text  := IntToStr(Ord(XonChar));
  55.   XoffCharEdit.Text := IntToStr(ord(XoffChar));
  56. end;
  57.  
  58. procedure TFlowControlForm.OkBtnClick(Sender: TObject);
  59. var
  60.   E    : Integer;
  61.   Temp : Byte;
  62.  
  63. begin
  64.   case HardwareFlowGroup.ItemIndex of
  65.     0: HdwFlow := [];
  66.     1: HdwFlow := [hwfUseDTR, hwfRequireDSR];
  67.     2: HdwFlow := [hwfUseRTS, hwfRequireCTS];
  68.   end;
  69.  
  70.   if TransmitFlowBox.Checked and ReceiveFlowBox.Checked then
  71.     SfwFlow := swfBoth
  72.   else if TransmitFlowBox.Checked then
  73.     SfwFlow := swfTransmit
  74.   else if ReceiveFlowBox.Checked then
  75.     SfwFlow := swfReceive;
  76.  
  77.   Val(XonCharEdit.Text, Temp, E);
  78.   if (E = 0) then
  79.     XonChar := Char(Temp);
  80.   Val(XoffCharEdit.Text, Temp, E);
  81.   if (E = 0) then
  82.     XoffChar := Char(Temp);
  83. end;
  84.  
  85. end.
  86.  
  87.