⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adduser2.pas

📁 dephi 7.0实现的TDMA工作原理.用于演示TDMA的工作流程
💻 PAS
字号:
unit adduser2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons,pubdata, ExtCtrls;

type
  Tadduser2frm = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    RadioGroup1: TRadioGroup;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  adduser2frm: Tadduser2frm;

implementation

uses run3, run;

{$R *.dfm}

procedure Tadduser2frm.BitBtn2Click(Sender: TObject);
begin
if timer_state=true then
   runfrm.timer1.enabled:=true;
check_box[adduser_no].checked:=false;
close;
end;

procedure Tadduser2frm.BitBtn1Click(Sender: TObject);
var
   temp1:integer;
begin
if edit1.text='' then
   showmessage('请输入数据长度(1~10)')
else if (strtoint(edit1.Text)>10)or(strtoint(edit1.Text)=0) then
   showmessage('请输入1~10内的整数')
else
   begin
   user_request[adduser_no]:=strtoint(edit1.text);      //将用户加入请求队列
   if runfrm.label18.Caption='' then
      runfrm.label18.Caption:=inttostr(adduser_no)
   else
      runfrm.label18.Caption:=runfrm.label18.Caption+'、'+inttostr(adduser_no);
   user_request_label[adduser_no].Caption:='请求加入';

   //设置优先级
   if RadioButton1.Checked then
      user_pri[adduser_no]:=1;
   if RadioButton2.Checked then
      user_pri[adduser_no]:=2;
   if RadioButton3.Checked then
      user_pri[adduser_no]:=3;
   if RadioButton4.Checked then
      user_pri[adduser_no]:=4;
   if RadioButton5.Checked then
      user_pri[adduser_no]:=5;

   if timer_state=true then
      runfrm.timer1.enabled:=true;

   //初始化作图区
   temp1:=strtoint(edit1.Text);
   runfrm.data_show(temp1,adduser_no,'S');
   runfrm.data_show(0,adduser_no,'R');

   close;
   end;
end;

procedure Tadduser2frm.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in['0','1','2','3','4','5','6','7','8','9',#8,#13]) then
   key:=#0
else if key=#13 then
   BitBtn1Click(Sender);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -