delphi的问题,大虾们帮我看下,为什么不管我在edit1里面输入1,2,3,按下button都得不到返回值?
unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,F...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
edt1: TEdit;
procedure Edit1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure edt1Change(Sender: TObject);
//function TForm1.SCLen : integer;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ARPAZoom : array[0..10] of double =
(0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96);
ARPAZoomNo : integer ; //缩放序列号,初试化为7,即屏幕显示12分
Radius :Integer=335;
SeaClutterLevel:Integer=32;
w:Integer;
implementation
{$R *.dfm}
function SCLen : integer;
var
CRadius : integer; //杂波半径,最大为一般显示5海里,折算为像素;
begin
{ 缩放参数 ARPAZoom (0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96) }
case ARPAZoomNo of //0.125,0.25,0.50,0.75,1.5,3
0,1,2,3,4,5 :
CRadius := Radius;
else //>=6
CRadius := Round(Radius * 5/ARPAZoom[ARPAZoomNo]);
end;
Result := Round(CRadius* SeaClutterLevel/64);
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
ARPAZoomNo:=strtoint(Edit1.text);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
w:=SCLen;
end;
procedure TForm1.edt1Change(Sender: TObject);
begin
edt1.Text:=IntToStr(w);
end;
end. 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
edt1: TEdit;
procedure Edit1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure edt1Change(Sender: TObject);
//function TForm1.SCLen : integer;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ARPAZoom : array[0..10] of double =
(0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96);
ARPAZoomNo : integer ; //缩放序列号,初试化为7,即屏幕显示12分
Radius :Integer=335;
SeaClutterLevel:Integer=32;
w:Integer;
implementation
{$R *.dfm}
function SCLen : integer;
var
CRadius : integer; //杂波半径,最大为一般显示5海里,折算为像素;
begin
{ 缩放参数 ARPAZoom (0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96) }
case ARPAZoomNo of //0.125,0.25,0.50,0.75,1.5,3
0,1,2,3,4,5 :
CRadius := Radius;
else //>=6
CRadius := Round(Radius * 5/ARPAZoom[ARPAZoomNo]);
end;
Result := Round(CRadius* SeaClutterLevel/64);
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
ARPAZoomNo:=strtoint(Edit1.text);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
w:=SCLen;
end;
procedure TForm1.edt1Change(Sender: TObject);
begin
edt1.Text:=IntToStr(w);
end;
end. 展开
展开全部
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
edt1: TEdit;
edt2: TEdit;
btn1: TButton;
procedure edt1Change(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
// function SCLen(): integer;
end;
var
Form1: TForm1;
ARPAZoom : array[0..10] of double =
(0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96);
ARPAZoomNo : integer ; //缩放序列号,初试化为7,即屏幕显示12分
Radius :Integer=335;
SeaClutterLevel:Integer=32;
w:Integer;
implementation
{$R *.dfm}
function SCLen : integer;
var
CRadius : integer; //杂波半径,最大为一般显示5海里,折算为像素;
begin
{ 缩放参数 ARPAZoom (0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96) }
case ARPAZoomNo of //0.125,0.25,0.50,0.75,1.5,3
0,1,2,3,4,5 :
CRadius := Radius;
else //>=6
CRadius := Round(Radius * 5/ARPAZoom[ARPAZoomNo]);
end;
Result := Round(CRadius* SeaClutterLevel/64);
end;
procedure TForm1.edt1Change(Sender: TObject);
begin
ARPAZoomNo:=strtoint(Edt1.text);
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
w:=SCLen;
edt2.Text:=IntToStr(w);
end;
end.
edt1(第二个文本框)的变化事件根本没有触发所以得不到值,现在这样就可以。
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
edt1: TEdit;
edt2: TEdit;
btn1: TButton;
procedure edt1Change(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
// function SCLen(): integer;
end;
var
Form1: TForm1;
ARPAZoom : array[0..10] of double =
(0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96);
ARPAZoomNo : integer ; //缩放序列号,初试化为7,即屏幕显示12分
Radius :Integer=335;
SeaClutterLevel:Integer=32;
w:Integer;
implementation
{$R *.dfm}
function SCLen : integer;
var
CRadius : integer; //杂波半径,最大为一般显示5海里,折算为像素;
begin
{ 缩放参数 ARPAZoom (0.125,0.25,0.50,0.75,1.5,3,6,12,24,48,96) }
case ARPAZoomNo of //0.125,0.25,0.50,0.75,1.5,3
0,1,2,3,4,5 :
CRadius := Radius;
else //>=6
CRadius := Round(Radius * 5/ARPAZoom[ARPAZoomNo]);
end;
Result := Round(CRadius* SeaClutterLevel/64);
end;
procedure TForm1.edt1Change(Sender: TObject);
begin
ARPAZoomNo:=strtoint(Edt1.text);
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
w:=SCLen;
edt2.Text:=IntToStr(w);
end;
end.
edt1(第二个文本框)的变化事件根本没有触发所以得不到值,现在这样就可以。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你有2个edit,一个是edit1,另一个是edt1
procedure TForm1.edt1Change(Sender: TObject);
begin
edt1.Text:=IntToStr(w);
end;
只有edt1的change事件触发了,才会有返回值?
建议 你修改如下
procedure TForm1.Button1Click(Sender: TObject);
begin
w:=SCLen;
edt1.Text:=IntToStr(w);
end;
然後把procedure TForm1.edt1Change(Sender: TObject);去掉
procedure TForm1.edt1Change(Sender: TObject);
begin
edt1.Text:=IntToStr(w);
end;
只有edt1的change事件触发了,才会有返回值?
建议 你修改如下
procedure TForm1.Button1Click(Sender: TObject);
begin
w:=SCLen;
edt1.Text:=IntToStr(w);
end;
然後把procedure TForm1.edt1Change(Sender: TObject);去掉
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
function SCLen : integer;换成function SCLen( ARPAZoomNo:int) : integer;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询