View Issue Details

IDProjectCategoryView StatusLast Update
0004119JEDI VCL00 JVCL Componentspublic2007-06-18 04:59
Reporterraducu84Assigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionduplicate 
Product Version3.00 BETA 
Target VersionFixed in Version3.00 
Summary0004119: TJvCheckTreeView Check/Uncheck not working
Descriptioni put an TJvCheckTreeView on a form, i hadn't build it on runtime, children have been added on at design time. next, i tried to uncheck all the checkboxes but i had a surprise, it won't work. the procedure is shown bellow:
procedure TForm1.Button1Click(Sender: TObject);
var n:TTreeNode;
  b:boolean;
begin
 b:=false;
 n:=JvCheckTreeView1.Items.GetFirstNode;
  while n<>nil do
   begin
// JvCheckTreeView1.SetChecked(n,b);
    JvCheckTreeView1.CheckBox[n]:=false;
    n:=n.GetNext;
   end;
end;

the entire form source can be found bellow:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, JvExComCtrls, JvComCtrls, JvCheckTreeView, StdCtrls;

type
  TForm1 = class(TForm)
    JvCheckTreeView1: TJvCheckTreeView;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure JvCheckTreeView1MouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var n:TTreeNode;
  b:boolean;
begin
 b:=false;
 n:=JvCheckTreeView1.Items.GetFirstNode;
  while n<>nil do
   begin
// JvCheckTreeView1.SetChecked(n,b);
    JvCheckTreeView1.CheckBox[n]:=false;
    n:=n.GetNext;
   end;
end;

procedure TForm1.JvCheckTreeView1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var node_sel,f:TTreeNode;
    p:tpoint;
    b:boolean;
begin
 getcursorpos(p);
 node_sel:=JvCheckTreeView1.GetNodeAt(x,y);
 b:=JvCheckTreeView1.GetChecked(node_sel);
  f:=node_sel.getFirstChild;
    while (f<>nil) do
     begin
      JvCheckTreeView1.SetChecked(f,b);
      f:=f.GetNextChild(f);
     end;
  end;

end.

also, i observed that if i want to check all the checkboxes first i must uncheck all, and only after to check them:
(n:TTreenode)
    JvCheckTreeView1.SetChecked(n,true);
    JvCheckTreeView1.SetChecked(n,false);

it should work only in this way?

best regards,
TagsNo tags attached.

Relationships

duplicate of 0003530 resolvedAHUser TJvCheckTreeView Checkboxes not displayed when cbsJVCL style is used 

Activities

Kyle_Katarn

2007-06-15 14:07

reporter   ~0013330

Would the following command fix your problem ?

for I := 0 to tv.Items.Count-1 do TJvTreeNode(tv.Items[i]).Checked := False;

tv defined as :

object tv: TJvCheckTreeView
    Left = 8
    Top = 8
    Width = 241
    Height = 308
    Anchors = [akLeft, akTop, akRight, akBottom]
    HideSelection = False
    Images = MainDlg.imglst
    Indent = 19
    ReadOnly = True
    StateImages = ilFlatChecks
    TabOrder = 0
    LineColor = 13160660
    Checkboxes = True
    CheckBoxOptions.Style = cbsJVCL
    CheckBoxOptions.CascadeOptions = []
    OnToggled = tvToggled
  end

Kyle_Katarn

2007-06-15 14:09

reporter   ~0013331

Read this : http://homepages.borland.com/jedi/issuetracker/view.php?id=3530

obones

2007-06-18 04:59

administrator   ~0013380

Please use the latest version

Issue History

Date Modified Username Field Change
2007-05-02 03:17 raducu84 New Issue
2007-06-15 14:07 Kyle_Katarn Note Added: 0013330
2007-06-15 14:09 Kyle_Katarn Note Added: 0013331
2007-06-18 04:59 obones Relationship added duplicate of 0003530
2007-06-18 04:59 obones Duplicate ID 0 => 3530
2007-06-18 04:59 obones Status new => resolved
2007-06-18 04:59 obones Fixed in Version => 3.00
2007-06-18 04:59 obones Resolution open => duplicate
2007-06-18 04:59 obones Assigned To => obones
2007-06-18 04:59 obones Note Added: 0013380