View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003361 | JEDI VCL | 00 JVCL Components | public | 2005-12-12 10:08 | 2006-01-05 08:02 |
Reporter | hansverlouw3 | Assigned To | obones | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | 3.20 | |||
Summary | 0003361: Get and set checkbox value in TJvTreeView | ||||
Description | When a checkbox is checked, I want to check all its children as well. But I cannot determine if a checkbox has changed. Isn't there a property missing? I tested with procedure TfrmMain.JvTreeView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if TJvTreeNode(JvTreeView1.GetNodeAt(x,y)).checked then Panel1.Color := clGreen else Panel1.Color := clRed; end; | ||||
Tags | No tags attached. | ||||
|
Found the solution myself ;-) Use TJvCheckTreeView in stead of TJvTreeView. TJvCheckTreeView has an event OnToggled. By the way, note that it only behaves ok when CheckBoxOptions.Style = cbsJVCL. So to cascade checkbox values on toggling a node, use something like this: procedure TfrmMain.JvTreeView1Toggled(Sender: TObject; Node: TTreeNode); var i: integer; Child: TTreeNode; begin Child := Node.getFirstChild; for i := 0 to Node.Count - 1 do begin TJvTreeNode(Child).Checked := TJvTreeNode(Node).Checked; Child := Node.GetNextChild(Child); end; end; |
|
A recursive implementation of the procedure in the previous note: procedure TfrmMain.CheckCascading(Node: TTreeNode); var i: integer; Child: TTreeNode; begin Child := Node.getFirstChild; for i := 0 to Node.Count - 1 do begin TJvTreeNode(Child).Checked := TJvTreeNode(Node).Checked; CheckCascading(Child); Child := Node.GetNextChild(Child); end; end; procedure TfrmMain.JvTreeView1Toggled(Sender: TObject; Node: TTreeNode); begin CheckCascading(Node); end; |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-12-12 10:08 | hansverlouw3 | New Issue | |
2005-12-13 05:01 | hansverlouw3 | Note Added: 0008214 | |
2005-12-13 05:31 | hansverlouw3 | Note Added: 0008215 | |
2006-01-05 08:02 | obones | Status | new => resolved |
2006-01-05 08:02 | obones | Resolution | open => fixed |
2006-01-05 08:02 | obones | Assigned To | => obones |
2010-10-30 15:52 | outchy | Relationship added | has duplicate 0005386 |
2010-10-30 15:53 | outchy | Relationship deleted | has duplicate 0005386 |