程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> 實現VirtualTree的Editor的功能定制之setBounds

實現VirtualTree的Editor的功能定制之setBounds

編輯:Delphi

  
  //做的改動

  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;

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved