procedure updDescrption(sender:Tmemo);
begin
sender.ReadOnly:=false;
end;
procedure savDescrption(sender:Tmemo);
begin
DM.aq_pub.Close;
DM.aq_pub.SQL.Clear;
DM.aq_pub.SQL.Add('update b_help set vHelpText=:helptext where cHelpNo=''001''' ) ;
DM.aq_pub.Parameters.ParamByName('helptext').Value :=sender.text;
DM.aq_pub.ExecSQL;
end;
procedure Tf_customer_jbzl.ToolButton5Click(Sender: TObject);
var
pnHelp:TPanel;
memoHelp:TMemo;
subpop:TPopupMenu;
subMenuitem:array[1..2] of TMenuItem;
begin
if flag=0 then
begin
pnHelp := TPanel.Create(Self);
with pnHelp do begin
Parent := f_customer_jbzl;
Name:='pnHelp';
Align := albottom;
Left := 0;
Top :=0;
height:=100 ;
visible:=true;
end;
memoHelp := TMemo.Create(Self);
with memoHelp do begin
Parent :=pnHelp;
Name:='memoHelp';
Align := alclient ;
Left := 0;
Top := 0;
font.color:=clRed;
font.Name:='ËÎÌå';
font.size:=10;
popupmenu:=PopupMenu3;
readonly:=true;
visible:=true;
end;
DM.aq_pub.Close;
DM.aq_pub.SQL.Clear;
DM.aq_pub.SQL.Add('select * from b_help where cHelpNo=''001''' ) ;
DM.aq_pub.open;
memoHelp.text:=DM.aq_pub.FieldByName('vHelpText').AsString;
subpop:=TpopupMenu.Create(self);
submenuItem[1]:=TMenuItem.Create(self);
submenuItem[1].caption:='ÐÞ¸Ä˵Ã÷';
submenuItem[1].onclick:=updDescrption(memoHelp);//这句为何有错,如何改
subpop.Items.add(submenuItem[1]);
submenuItem[2]:=TMenuItem.Create(self);
submenuItem[2].caption:='±£´æ˵Ã÷';
submenuItem[2].onclick:=savDescrption(memoHelp););//这句为何有错,如何改
subpop.Items.add(submenuItem[2]);
memoHelp.popupmenu:=subpop;
hlpHeight:=pnHelp.Height;
f_customer_jbzl.Height:=f_customer_jbzl.Height+hlpHeight;
flag:=1;
end
else
begin
if f_customer_jbzl.FindComponent('pnHelp')<>nil then
f_customer_jbzl.FindComponent('pnHelp').Free;
if f_customer_jbzl.FindComponent('memoHelp')<>nil then
f_customer_jbzl.FindComponent('memoHelp').Free;
if f_customer_jbzl.FindComponent('subpop')<>nil then
f_customer_jbzl.FindComponent('subpop').Free;
f_customer_jbzl.Height:=f_customer_jbzl.Height-hlpHeight ;
flag:=0;
end
end;提示错误:Incompatible types: 'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter',如何改呀!
begin
sender.ReadOnly:=false;
end;
procedure savDescrption(sender:Tmemo);
begin
DM.aq_pub.Close;
DM.aq_pub.SQL.Clear;
DM.aq_pub.SQL.Add('update b_help set vHelpText=:helptext where cHelpNo=''001''' ) ;
DM.aq_pub.Parameters.ParamByName('helptext').Value :=sender.text;
DM.aq_pub.ExecSQL;
end;
procedure Tf_customer_jbzl.ToolButton5Click(Sender: TObject);
var
pnHelp:TPanel;
memoHelp:TMemo;
subpop:TPopupMenu;
subMenuitem:array[1..2] of TMenuItem;
begin
if flag=0 then
begin
pnHelp := TPanel.Create(Self);
with pnHelp do begin
Parent := f_customer_jbzl;
Name:='pnHelp';
Align := albottom;
Left := 0;
Top :=0;
height:=100 ;
visible:=true;
end;
memoHelp := TMemo.Create(Self);
with memoHelp do begin
Parent :=pnHelp;
Name:='memoHelp';
Align := alclient ;
Left := 0;
Top := 0;
font.color:=clRed;
font.Name:='ËÎÌå';
font.size:=10;
popupmenu:=PopupMenu3;
readonly:=true;
visible:=true;
end;
DM.aq_pub.Close;
DM.aq_pub.SQL.Clear;
DM.aq_pub.SQL.Add('select * from b_help where cHelpNo=''001''' ) ;
DM.aq_pub.open;
memoHelp.text:=DM.aq_pub.FieldByName('vHelpText').AsString;
subpop:=TpopupMenu.Create(self);
submenuItem[1]:=TMenuItem.Create(self);
submenuItem[1].caption:='ÐÞ¸Ä˵Ã÷';
submenuItem[1].onclick:=updDescrption(memoHelp);//这句为何有错,如何改
subpop.Items.add(submenuItem[1]);
submenuItem[2]:=TMenuItem.Create(self);
submenuItem[2].caption:='±£´æ˵Ã÷';
submenuItem[2].onclick:=savDescrption(memoHelp););//这句为何有错,如何改
subpop.Items.add(submenuItem[2]);
memoHelp.popupmenu:=subpop;
hlpHeight:=pnHelp.Height;
f_customer_jbzl.Height:=f_customer_jbzl.Height+hlpHeight;
flag:=1;
end
else
begin
if f_customer_jbzl.FindComponent('pnHelp')<>nil then
f_customer_jbzl.FindComponent('pnHelp').Free;
if f_customer_jbzl.FindComponent('memoHelp')<>nil then
f_customer_jbzl.FindComponent('memoHelp').Free;
if f_customer_jbzl.FindComponent('subpop')<>nil then
f_customer_jbzl.FindComponent('subpop').Free;
f_customer_jbzl.Height:=f_customer_jbzl.Height-hlpHeight ;
flag:=0;
end
end;提示错误:Incompatible types: 'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter',如何改呀!
解决方案 »
- 大家好,新手问题。请多帮忙
- 急!在DBGridEh 控件中,已经允许选中多列,现在呢? ,俺想将已选中的多行,复制到表A 中,再将dbgridEh中的行,给删除? 如何实现?
- MIDAS/ADO/SQLSERVER中使用BLOB字段问题
- 为什么读出来的是中文是乱码?
- 快!快!快!
- 关于局域网内的邮件收发问题
- 散分!寻求西南地区的软件公司的资料和联系方式.
- delphi6安装后,有一个java是干什么用的?
- 为何我的程序运行后是空的,我连的是d6自带的dbdemos数据库而且这程序是好的
- 请问在delphi里如何实现自定义IP头?
- 奇怪的INSERT问题,急!!!
- 我想请教一下 treeview 的使用操作
/////////submenuItem[1].onclick:=updDescrption;
procedure updDescrption(sender:Tmemo);
begin
sender.ReadOnly:=false;
end;
////////这里的定义也要改
procedure updDescrption(sender:TObject);
begin
sender.ReadOnly:=false;
end;
TNotifyEvent = procedure(Sender: TObject) of object;
从面可以知道OnClick事件并非是一个过程下面是一个例子,楼主可以看看unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
//请注意
procedure ButtonClick(Sender: TObject);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}//实现
procedure TForm1.ButtonClick(Sender: TObject);
begin
//做你的事情
ShowMessage(Sender.ClassName + 'Button Click');
end;procedure TForm1.FormCreate(Sender: TObject);
begin
//注意
Button1.OnClick := ButtonClick;
end;end.