我在窗体上放了两个TRadioButton控件,代码如下:
unit Utest;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
first: TRadioButton;
second: TRadioButton;
procedure secondClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.secondClick(Sender: TObject);
begin
Application.MessageBox('我靠','怎么回事?');
first.Checked := true;
end;end.运行,第一次先点击‘不要点我’按钮,确定后,和系统上其他窗口切换一下,再点击该该程序的窗口,就一直弹出对话框,这是怎么回事,请大虾们给个答案,本人不胜感激!
unit Utest;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
first: TRadioButton;
second: TRadioButton;
procedure secondClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.secondClick(Sender: TObject);
begin
Application.MessageBox('我靠','怎么回事?');
first.Checked := true;
end;end.运行,第一次先点击‘不要点我’按钮,确定后,和系统上其他窗口切换一下,再点击该该程序的窗口,就一直弹出对话框,这是怎么回事,请大虾们给个答案,本人不胜感激!
哈哈:
Application.MessageBox('我靠','怎么回事?');
first.Checked := true;
first.SetFocus ;加一行代码就可以了
因为你给first赋值时, first 变了 但 焦点没有改变,加一行代码就可以了
procedure TForm1.secondClick(Sender: TObject);
begin
first.Checked := true;
end;
把弹出对话框语句加在second控件的MouseDown事件中即可.
procedure TForm1.secondMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Application.MessageBox('我靠','怎么回事?');
end;
第101次弹出:“我靠,就这么回事,爱咋咋的!——比尔”
楼主可以试试。
据说是Borland的人没有和比尔沟通好的关系。