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',如何改呀!

解决方案 »

  1.   

    submenuItem[1].onclick:=updDescrption(memoHelp);//这句为何有错,如何改
    /////////submenuItem[1].onclick:=updDescrption;
    procedure updDescrption(sender:Tmemo);
    begin
      sender.ReadOnly:=false;
    end;
    ////////这里的定义也要改
    procedure updDescrption(sender:TObject);
    begin
      sender.ReadOnly:=false;
    end;
      

  2.   

    procedure savDescrption(sender:Tmemo);的修改参照上面的就可以了
      

  3.   

    楼主看看TNotifyEvent的定义:
    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.
      

  4.   

    你不对,问题我函数参数是TMEMO,传过去的参数也是TMEMo,我实现的功能就是点击弹出菜单项(创建的控件)实现向自定义的创建的控件赋值,怎么实现!改成TObject,能行吗
      

  5.   

    你不对,问题我函数参数是TMEMO,传过去的参数也是TMEMo,我实现的功能就是点击弹出菜单项(创建的控件)实现向自定义的创建的控件赋值,怎么实现!改成TObject,能行吗,这样就代表是Tobject是弹出菜单项,而不是TMEMO,问题我要求参数是TMEmo