当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: up ......
    摘要: 在vc下用odbc编程,使用类crecordset进行操作,增加一条记录,某一个字段类型是“备注”类型,写进去的字符串长度超过256个字节(我试了写进去200个字节没事,300个字节就出事)的时候,update()的时候就报错,提示: error: cstring buffer (column 10) address has changed! 不过在release下没事。是什么问题呀?大家......


★★★★自定义控件如何打开窗体,并获得相关值★★★★

为尊重各位的热情回答,特另开此帖,接原帖:  
  http://expert.csdn.net/Expert/topic/1658/1658933.xml?temp=.1598017  
   
  我做了2个包,pack.dpk,dclpack.dpk,第二个包专门注册控件、参数编辑的设  
   
  计时包,我在控件的设计时的右键添加了一功能,打开某编辑窗体进  
   
  行编辑,请问如何调用这个窗体?  
   
  ---------------------------------  
  type  
      TPopEdit   =   class(TComponentEditor)  
          procedure   ExecuteVerb(Index:   Integer);   override;  
          function   GetVerb(Index:   Integer):   string;   override;  
          function   GetVerbCount:   Integer;   override;  
      end;  
  ---------------------------------  
  procedure   TPopEdit.ExecuteVerb(Index:   Integer);  
  begin  
      inherited;  
      case   Index   of  
          0:   ;//这里怎么调用EditFrm  
      end;  
  end;  
  ---------------------------------  
  另外,EditFrm应该放在哪个包里?   pack.dpk?dclpack.dpk?  
   
  控件单元在pack.dpk包里,这个单元要获得EditFrm编辑的参数。  
   
  例如:我在comp.pas定义了public变量vStr,  
   
  这个变量需要在EditFrm中编辑并获得,如何做?

NO.1   作者: xzgyb

就是取它的Component就行了  
  如下:  
  unit   MyTestComponent;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Classes;  
   
  type  
      TMyTestComponent   =   class(TComponent)  
      private  
          {   Private   declarations   }  
          FFileName:   string;  
      protected  
          {   Protected   declarations   }  
      public  
          {   Public   declarations   }  
      published  
          {   Published   declarations   }  
          property   FileName:   string   read   FFileName   write   FFileName;  
      end;  
   
   
  implementation  
   
   
  end.  
   
  这个在MyTestComponentPack  
   
   
  unit   MyTestComponentReg;  
   
  interface  
   
  uses   Controls,   Classes,   DesignIntf,   DesignEditors;  
   
  type  
      TMyTestComponentEditor   =   class(TComponentEditor)  
      public  
          procedure   ExecuteVerb(Index:   Integer);   override;  
          function   GetVerb(Index:   Integer):   string;   override;  
          function   GetVerbCount:   Integer;   override;  
      end;  
   
      procedure   Register;  
   
  implementation  
   
  uses   MyTestComponent,   EditFormUnit;  
   
  {   TMyTestComponentEditor   }  
   
  procedure   Register;  
  begin  
      RegisterComponents(GybCtrl,   [TMyTestComponent]);  
      RegisterComponentEditor(TMyTestComponent,   TMyTestComponentEditor);  
  end;  
   
  procedure   TMyTestComponentEditor.ExecuteVerb(Index:   Integer);  
  begin  
      if   Index   =   0   then  
      with   TEditForm.Create(nil)   do  
      try  
          Edit1.Text   :=   TMyTestComponent(Component).FileName;  
          if   ShowModal   =   mrOk   then  
              TMyTestComponent(Component).FileName   :=   Edit1.Text;  
      finally  
          Free;  
      end;  
  end;  
   
  function   TMyTestComponentEditor.GetVerb(Index:   Integer):   string;  
  begin  
      if   Index   =   0   then  
          Result   :=   设置FileName属性...;  
  end;  
   
  function   TMyTestComponentEditor.GetVerbCount:   Integer;  
  begin  
      Result   :=   1;  
  end;  
   
  end.  
   
  这个和窗体在dclMyTestComponentPack里  
 

NO.2   作者: newyj

property   FileNames:   Tstrings   read   FFileNames   write   FFileNames   stored   true;  
  试试  
 


 ·问一个linux的初级问题    »显示摘要«
    摘要: 在linux下安装软件的时候不是rpm包的,如tar.gz什么的. 先解压可以理解,用tar什么的, make是做什么呢?还有./xxxx什么的,都是什么意思呢?能给一个安装软件的大概步骤吗?解释一下各各步分的意思. ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE