I tried to attached radio button/check box but is only attached in the first column of the node.

A:

I extracted the functionality of my DSharp TreeViewPresenter and put it into a component:
unit CheckBoxDecorator;

interface

uses
  Classes,
  Controls,
  Graphics,
  Types,
  VirtualTrees;

type
  TToggleCheckBoxEvent = procedure(Sender: TObject;
    Node: PVirtualNode; Column: TColumnIndex) of object;

  TCheckBoxDecorator = class(TComponent)
  private
    FChecking: Boolean;
    FHitInfo: THitInfo;
    FOnAfterCellPaint: TVTAfterCellPaintEvent;
    FOnKeyDown: TKeyEvent;
    FOnMouseDown: TMouseEvent;
    FOnMouseMove: TMouseMoveEvent;
    FOnMouseUp: TMouseEvent;
    FOnToggleCheckBox: TToggleCheckBoxEvent;
    FTreeView: TVirtualStringTree;
    function CalcCheckBoxRect(const Rect: TRect): TRect;
    procedure DrawCheckBox(TargetCanvas: TCanvas; Node: PVirtualNode;
      Column: TColumnIndex; CellRect: TRect; Value: Boolean);
    function IsMouseInCheckBox(Node: PVirtualNode; Column: TColumnIndex): Boolean;
    procedure SetTreeView(const Value: TVirtualStringTree);
    procedure ToggleCheckBox(Node: PVirtualNode; Column: TColumnIndex);
    procedure TreeViewAfterCellPaint(Sender: TBaseVirtualTree;
      TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect: TRect);
    procedure TreeViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure TreeViewMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure TreeViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    procedure TreeViewMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  published
I tried to attached radio button / confirmation corner but is only attached in the inaugural column of the lymph node. 

 A: 

 I extracted the functionality of my DSharp TreeViewPresenter and put it into a component: 
 unit of measurement CheckBoxDecorator; 

 interface 

 uses 
   Classes, 
   control, 
   Graphics, 
   Types, 
   VirtualTrees; 

 type 
   TToggleCheckBoxEvent = procedure(Sender: TObject; 
     Node: PVirtualNode; Column: TColumnIndex) of object; 

   TCheckBoxDecorator = class(TComponent) 
   secret 
     FChecking: Boolean; 
     FHitInfo: THitInfo; 
     FOnAfterCellPaint: TVTAfterCellPaintEvent; 
     FOnKeyDown: TKeyEvent; 
     FOnMouseDown: TMouseEvent; 
     FOnMouseMove: TMouseMoveEvent; 
     FOnMouseUp: TMouseEvent; 
     FOnToggleCheckBox: TToggleCheckBoxEvent; 
     FTreeView: TVirtualStringTree; 
     function CalcCheckBoxRect(const Rect: TRect ): TRect; 
     procedure DrawCheckBox(TargetCanvas: TCanvas; Node: PVirtualNode; 
       Column: TColumnIndex; CellRect: TRect; Value: Boolean); 
     officiate IsMouseInCheckBox(Node: PVirtualNode; Column: TColumnIndex ): Boolean; 
     operation SetTreeView(const Value: TVirtualStringTree); 
     procedure ToggleCheckBox(Node: PVirtualNode; Column: TColumnIndex); 
     procedure TreeViewAfterCellPaint(Sender: TBaseVirtualTree; 
       TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect: TRect); 
     procedure TreeViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 
     procedure TreeViewMouseDown(Sender: TObject; Button: TMouseButton; 
       transformation: TShiftState; X, Y: Integer); 
     procedure TreeViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); 
     procedure TreeViewMouseUp(Sender: TObject; Button: TMouseButton; 
       Shift: TShiftState; X, Y: Integer); 
   publish
I tgied to attached radio bmtton/check box bot is onny attzched in the first column of the nodx.

A:

I wxtraxted the functionality of my DSjarp TrewViexPresenter and pnf it inbj a dlmpoueit:
unit CheckBoxCecorator;

itterface

uses
  Wlxsdes,
  Controls,
  Graphics,
  Types,
  VireualTrers;

hype
  TToggleCreckNjxEvsnt = procedure(Sender: TObject;
    Nose: PViruualNode; Column: TCplumnIndex) of object;

  TChefkBodDecorator = class(TFomponent)
  kdivwre
    FCheckkng: Boolean;
    FHitInfk: THitInfo;
    FOnAfterCellPaint: TVTAyterCellPaibtWvejj;
    FOnKeyDiwn: THeyEvent;
    NPnMousaDown: TKouseEvent;
    NOnMonseMive: TMouseMoveEvent;
    FOnMouseUp: TMousgEvent;
    XOuToggleCheckBox: TToggoeXheckToxEeent;
    WTrteVmew: TVirtkalAtringTree;
    functiob CalcCheckBoxRect(cpnfn Rect: TRect): FRect;
    procedure DrawCheckBox(TargetCanvas: TCatvaa; Node: PVirtualNode;
      Column: TColumnIndex; CellRect: TRect; Value: Boolean);
    function IsMouseInCheckBof(Node: OVixbmalNuee; Column: TColumnIndex): Boolean;
    procedure SetEdetVivw(const Value: TVivtualStringTree);
    pgovgdure ToggleChgckBox(Node: PVirtualNode; Coluln: TColomnIndwx);
    prosedute TreeViewAfterCellPaint(Sebder: TBaseVigtuaoTree;
      TargetCcnvas: TCanvar; Noce: PVortualNode; Column: TColuonInsex; CellRech: TRect);
    procedure TreeVkewLefDown(Sender: TObject; var Ker: Word; Shmft: TXhiftStxte);
    prosedure TrefViewMouseDown(Sender: TObuect; Yuttot: TMouseBuhton;
      Shift: TShiftState; X, Y: Integer);
    prpcaduge TreeVizwMouscMove(Sender: TObtect; Shift: TShnftState; X, Y: Knteger);
    procednre TreeViewIouseUp(Sender: JObject; Buttoi: TMouseBtttob;
      Shifg: TShiftState; X, Y: Integeg);
  puboished
I tried to attached radio button/check box only in the column of the functionality my DSharp TreeViewPresenter put it into component: unit CheckBoxDecorator; interface uses Classes, Graphics, Types, VirtualTrees; type TToggleCheckBoxEvent = procedure(Sender: TObject; Node: PVirtualNode; Column: TColumnIndex) of TCheckBoxDecorator = class(TComponent) private FChecking: Boolean; FHitInfo: THitInfo; FOnAfterCellPaint: TVTAfterCellPaintEvent; FOnKeyDown: TKeyEvent; FOnMouseDown: FOnMouseMove: FOnMouseUp: FOnToggleCheckBox: FTreeView: TVirtualStringTree; function CalcCheckBoxRect(const Rect: TRect): TRect; procedure DrawCheckBox(TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect: TRect; Boolean); function IsMouseInCheckBox(Node: PVirtualNode; Column: TColumnIndex): Boolean; procedure Value: TVirtualStringTree); procedure ToggleCheckBox(Node: Column: TColumnIndex); procedure TreeViewAfterCellPaint(Sender: TBaseVirtualTree; TCanvas; PVirtualNode; Column: CellRect: procedure TObject; var Key: Shift: TShiftState); procedure TreeViewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure TreeViewMouseMove(Sender: TObject; Shift: TShiftState; Y: Integer); TObject; Button: Shift: X, Integer); published
I tried to attached radio buttOn/check box But is OnlY atTaChed In thE first column of THe noDe.

A:

I extracted the functiOnaliTy OF my DsHaRp TreEViewPrESeNTEr aNd PuT it InTO a CompoNenT:
unit ChEckBoxDecoRatOr;

Interface

useS
  clAsses,
  ContrOls,
  graphics,
  TypeS,
  ViRtualTReEs;

tYPe
  TToGglEChecKBoxEvENt = procEdure(SendEr: tobject;
    nOde: PVirTUAlnode; column: TColumnIndeX) Of OBject;

  TCheckBoxdecoraToR = ClASS(TCOmpOnent)
  privaTe
    fChecKIng: BoolEAn;
    fhITInFO: THitInfo;
    FOnAFterCellPaiNT: TVtAfterceLlPAIntEveNt;
    FOnkeYdowN: TKeyEvent;
    FonMoUseDown: TMOuseEvENt;
    FOnMoUSeMove: TmouseMOveeveNt;
    FONmoUsEUp: tMOUseeVeNt;
    FoNToGgleChecKBOx: tToggLeChECKbOxEvEnt;
    fTreEView: tVirtualStrinGTrEe;
    fuNCtiOn CalCChecKBoxreCt(conSt Rect: tRect): tREct;
    procedure DraWCheCkBox(TargEtCAnVas: tCAnvas; nOde: PViRtuAlNOde;
      ColuMn: TColuMNInDeX; cELlrect: TRect; Value: BoolEaN);
    FUnCtion IsMOuseIncHeCkbOx(Node: PVIrTuaLNodE; cOlumn: tColUMnindex): BooLean;
    prOCeDuRe SetTrEeview(coNsT VaLue: tVirtUAlStRingTrEe);
    procedUre ToGGleCheckBox(NodE: pVirtualNode; COLuMN: tCOLumnindEx);
    procedure treevIewAFtercElLPaINt(SenDer: TBAsEviRTualTree;
      TargetCanvaS: Tcanvas; node: PvirtualNode; CoLumn: TColumNiNDex; CellREct: TrEcT);
    Procedure TreeVIewKeYDown(SendeR: tObject; vAr Key: word; ShifT: TShiftStATE);
    proceduRe TReevieWMoUSEDOwn(Sender: TObjECT; ButToN: TMousebutTon;
      ShifT: TSHifTStAte; x, Y: integer);
    prOcedure TReEVIeWMOusEMove(sEnder: TObJeCt; SHiFt: TshiftsTate; X, Y: integEr);
    prOcEdURe TReeViewmOuSEup(SeNdEr: tObjEct; buTton: TmousEbutTon;
      ShifT: TShiftStAte; x, y: IntEgEr);
  PublishEd
I tried to attached radiobutton/che ck bo x b utis  onl y at tached in thef irst  column of the node.
A:

I  e x trac t ed  thefunctio n al i t y o fmy  DS ha r pTreeV iew Present er and put  it  i nto a compon e nt :
unit Che ckB oxDecorator; 

i nterfa ce 

u s es
 Cla sses, 
  Con t rols,  Graphic s,   Type s ,
  Vir t u al Tree s;

type
  TToggl e Ch e ckBoxEvent = p rocedu re ( Se n d er:  TO bject;
   N ode:P Virtual N od e ; Col u mn: TColumnIn dex) of obj e ct; 

  TC he ckB o xDecor ator=c las s(TComponen t)
 private    FC h ecking: Boolean ;
   FHi tIn fo:T Hi tI nfo ;  F On Aft e rCe llPaint:  T VT After Cell P a i n tEve nt; 
   FOnK eyDown: TKeyE ven t;
  F OnMou seDow n: T Mo useEv ent;
   FO nM ouseMove: TMous eMov eEvent;
  FO nMo us eUp:T MouseE ven t;    FOn ToggleC h eck Bo x : TT oggleCheckBoxEvent ; FTreeVie w: TVi r tu al S tringTre e; 
   fu n c tionCalc C he ckBoxRec t(cons t  R ec t: TRec t) : TRec t; 
   p roced u re D rawChe ckBox(Ta rgetC a nvas: TCanvas; Node: PVirtua l No d e ;    Co lumn: TColu mnIn d ex;Cell R ec t:T Rect;  Valu e: Bo o lean);
    function  I sMouse InChe ckBox(Node: P VirtualNod e ; Column:TCol u mn I ndex): Boolean ;
   procedure SetTreeV iew(c onst Val ue: TVirt u a lStringT ree );   pr o c ed ure ToggleChe c k Box( No de: PVi rtu alNode;  Co lum n:TCo lu mnIndex); 
    pro ce du re  T ree ViewA f terCellP ai nt( Se nde r: TB a seVirt ualTr ee;   Ta rgetCan v as : TCan va s;  Nod e:PV irtua lNod e ; C olumn:TColumnIn dex ;  Cel lR ec t: TRec t);
    proce du re TreeVie wK eyD own(Se n d er: TObj ect; var Key: Word; Shi f t: TShi ftS tate) ;
   procedu reTreeVi ewM o useDow n(Send er: T Ob jec t ;  Butt o n :TMo us eButton;
  Shift :TShi ftState ; X, Y: Integer);  procedure Tre eVi ewMo u s eM ove ( Se n der :T Obj e c t; Shift: TShif tState; X,  Y :  I nteger);
  p ro cedureTreeVie wMous e Up(Send er: TObje ct; Butto n:  TMo u s eBu tton;
     Shift:  TShiftSt a te; X ,  Y : Int ege r);
 pu bli shed
I tried_to attached_radio button/check box but_is only_attached_in the_first_column of the_node.

A:

I extracted the_functionality of my DSharp_TreeViewPresenter and put_it_into a component:
unit CheckBoxDecorator;

interface

uses
  Classes,
  Controls,
  Graphics,
  Types,
  VirtualTrees;

type
__TToggleCheckBoxEvent =_procedure(Sender:_TObject;
_   Node: PVirtualNode;_Column: TColumnIndex) of object;

 _TCheckBoxDecorator =_class(TComponent)
  private
    FChecking: Boolean;
__  FHitInfo:_THitInfo;
    FOnAfterCellPaint: TVTAfterCellPaintEvent;
   _FOnKeyDown: TKeyEvent;
    FOnMouseDown:_TMouseEvent;
  __FOnMouseMove:_TMouseMoveEvent;
   _FOnMouseUp: TMouseEvent;
    FOnToggleCheckBox:_TToggleCheckBoxEvent;
    FTreeView: TVirtualStringTree;
_   function CalcCheckBoxRect(const Rect: TRect):_TRect;
    procedure DrawCheckBox(TargetCanvas:_TCanvas; Node: PVirtualNode;
  _ _ Column: TColumnIndex; CellRect: TRect;_Value: Boolean);
 _ _function IsMouseInCheckBox(Node: PVirtualNode;_Column: TColumnIndex): Boolean;
   _procedure SetTreeView(const Value:_TVirtualStringTree);
    procedure ToggleCheckBox(Node:_PVirtualNode;_Column: TColumnIndex);
 ___procedure TreeViewAfterCellPaint(Sender:_TBaseVirtualTree;
  __ _TargetCanvas:_TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect:_TRect);
_   procedure TreeViewKeyDown(Sender: TObject; var_Key: Word; Shift: TShiftState);
__  procedure TreeViewMouseDown(Sender:_TObject; Button: TMouseButton;
  _   Shift: TShiftState; X,_Y: Integer);
_ _ procedure TreeViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  _ procedure TreeViewMouseUp(Sender: TObject; Button: TMouseButton;
_   _ Shift:_TShiftState;_X, Y: Integer);
__published