editnew[j]:=tedit.Create(self);
with editnew[j] do
begin
parent:=morecreatandfree;
Width:=150;
Text:='';
Left:=checknew[j].left+50;
OnKeyPress:=tquestion.enter;____ERROR
end;
这段代码你是否写在TQuestion类中
如果是改为:OnKeyPress:=enter;
如果不是那么需要有个QuestionObj:TQuestion
然后OnKeyPress:=QuestionObj.Enter;
with editnew[j] do
begin
parent:=morecreatandfree;
Width:=150;
Text:='';
Left:=checknew[j].left+50;
OnKeyPress:=tquestion.enter;____ERROR
end;
这段代码你是否写在TQuestion类中
如果是改为:OnKeyPress:=enter;
如果不是那么需要有个QuestionObj:TQuestion
然后OnKeyPress:=QuestionObj.Enter;
解决方案 »
- 求助:(懂delphi+好心的人请进!)帮忙解决一个问题,小弟愿出一定的现金作为酬劳费.在线等。
- 请教intraweb7.0 下如何在窗体左边加一个框架(iwFrame);
- 读xml文件的问题
- 在delphi中我想解form中的事件触发顺序,不知在帮助中哪里找?
- 請問如何使用DBGridEh中的多欄顯示
- 高分求:使用TCPClient 和TCPServer( Indy 9 ,Delphi 6) 进行跨网段连接的问题
- 请问那里有带checkbox的listView控件下载啊?
- 怎样可以拖动图片,就像拖动工具条那样
- 请问在delphi代码编辑中怎样快速移动光标到先前的位置(是否有快捷键)
- 随便问问 :-)
- 高手救命!SQL存储过程陷入死遁环?WHY??
- 怎么对多个数据库进行SQL语句查询?Delphi6+SQL2000 ---急!!!
var E : TEdit;
begin
E := TEdit.Create(self);
E.Parent := self;
E.OnKeyPress := form1.AKeyPress; //这里;
end;procedure TForm1.AKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
showmessage('fddd');
end;
procedure Tmorecreatandfree.morecreatandfreeactive(Sender: TObject);
var
j:integer;
QuestionObj:tquestion;
begin
with mydatanew.Tnewtiku do
begin
open;
last;
partmid:=FieldByName('tmid').Value+1;
append;
edit;
end; i:=strtoint(question.Edit11.text);
for j:=1 to i do
begin checknew[j]:=tcheckbox.Create(self);
with checknew[j] do
begin
Parent:=morecreatandfree;
left:=40;
Caption:=' '+chr(64+j);
end; editnew[j]:=tedit.Create(self);
with editnew[j] do
begin
parent:=morecreatandfree;
Width:=150;
Text:='';
Left:=checknew[j].left+50;
OnKeyPress:=QuestionObj.enterkeypress; end;[Warning] moreabcd.pas(68): Variable 'QuestionObj' might not have been initialized
你的tquestion显然是一个类
那么你要有这个类的实例,才能把方法指定出去!
QuestionObj:=Tquestion.Create是肯定要有的!!!我不知道 你的TQuestion是个什么类,正如yansea(思宏) 所说的
如果是个Form,则一般会有一个Form类实例,例如:
TForm1=class(TForm)end;Form1:TForm1;
(这里Form1是由系统隐含调用了Form1:=TForm1.create的)
这样,就可以指定
OnKeyPress:=Form1.enterkeypress;
而不是写成
OnKeyPress:=TForm1.enterkeypress;You know????????????????