首页 > 学院 > 开发设计 > 正文

实现VirtualTree的Editor的功能定制之setBounds

2019-11-18 17:57:54
字体:
来源:转载
供稿:网友


//做的改动

1.//function TStringEditLink.PRepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean;

    //you can set the value diaplaying int the editor here

    Text :=FTree.GetText(Node,Column);

    FirstMatch :=Pos ('(',Text );

    if FirstMatch <>0 then
       LastMatch :=Pos (')',Text )
    else
    begin
      FirstMatch :=Pos ('"',Text );
      if FirstMatch <>0 then
         LastMatch :=Pos (';',Text )-1;
    end;

   if LastMatch <>0 then
      Text :=Copy (Text,FirstMatch ,LastMatch -firstmatch+1);


2.//procedure TStringEditLink.SetBounds(R: TRect);

  //to change the left of bound

       text:= FTree.GetText(FNode,0);
       Offset :=Pos ('(',Text );

       if Offset =0 then
          Offset :=Pos ('"',Text );

       R.Left :=R.Left +Offset*5;
       R.Right :=R.Right -5;

3.//function TStringEditLink.BeginEdit: Boolean;
  //to show hint while editing
  FTree.Hint :=FTree.GetText(FNode,0);
  FTree.ShowHint :=True ;

4.
procedure TScriptsForm.DataTreeCreateEditor(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; out EditLink: IVTEditLink);

begin
   EditLink:= TStringEditLink.Create ;

end;


上一篇:创建具有托盘的服务程序

下一篇:编程实现网页表单数据的自动提交

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
学习交流
热门图片

新闻热点

疑难解答

图片精选

网友关注