procedure TCGI.LoadTV(var tv : TTreeView; s : String);
var Indices : TStringList;
var n : TTreeNode;
var v0, v1 ,v2 : String;
var TreeWidth : Integer;
var x, i, W : Integer;
s1: String;
begin
// Generic load tree assuming first three fields are sorted.
tv.Visible := False;
LoadSQLQuery(s, dm.Qry);
// Set the indices.
with dm.Qry do begin
if FieldCount > 2 then IndexFieldNames := Fields[0].FieldName + ';' + Fields[1].FieldName + ';' + Fields[2].FieldName
else IndexFieldNames := Fields[0].FieldName + ';' + Fields[1].FieldName;
end;
tv.Items.Clear;
TreeWidth := 0;
with dm.Qry do begin
Filtered := False;
first;
if FieldCount = 2 then begin
ShowMessage('Field count = 2');
while not eof do begin
n := tv.Items.AddChild(Nil, Fields[0].AsString);
v0 := n.Text;
TreeWidth := Max(TreeWidth, tv.Canvas.TextWidth(v0) + 50);
while (v0 = Fields[0].AsString) and not eof do begin
v1 := Fields[1].AsString;
TreeWidth := Max(TreeWidth, 65 + tv.Canvas.TextWidth(v1));
tv.Items.AddChild(n, Fields[1].AsString);
next;
end;
end;
end else begin
while not eof do begin
v0 := fields[0].AsString;
n := tv.Items.AddChild(Nil, v0);
v1 := '';
v2 := '';
// Now check.
while (v0 = Fields[0].AsString) and not eof do begin
v1 := Fields[1].AsString;
n := tv.Items.AddChild(n, v1);
v2 := '';
while (v1 = Fields[1].AsString) and not eof do begin
if (v2 <> fields[2].AsString) then begin
tv.Items.AddChild(n, fields[2].AsString);
v2 := fields[2].AsString;
TreeWidth := Max(TreeWidth, 85 + tv.Canvas.TextWidth(v2));
end;
next;
end;
n := n.Parent;
end;
end;
end;
end;
tv.Width := TreeWidth;
tv.Visible := True;
end;
Rituranjan
Participant
1231 Points
1279 Posts
please this convert in asp.net
Sep 16, 2010 04:56 AM|LINK
where tv=TreeView
s="SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.CO FROM V_HIERARCHY1 a"
procedure TCGI.LoadTV(var tv : TTreeView; s : String);
var Indices : TStringList;
var n : TTreeNode;
var v0, v1 ,v2 : String;
var TreeWidth : Integer;
var x, i, W : Integer;
s1: String;
begin
// Generic load tree assuming first three fields are sorted.
tv.Visible := False;
LoadSQLQuery(s, dm.Qry);
// Set the indices.
with dm.Qry do begin
if FieldCount > 2 then IndexFieldNames := Fields[0].FieldName + ';' + Fields[1].FieldName + ';' + Fields[2].FieldName
else IndexFieldNames := Fields[0].FieldName + ';' + Fields[1].FieldName;
end;
tv.Items.Clear;
TreeWidth := 0;
with dm.Qry do begin
Filtered := False;
first;
if FieldCount = 2 then begin
ShowMessage('Field count = 2');
while not eof do begin
n := tv.Items.AddChild(Nil, Fields[0].AsString);
v0 := n.Text;
TreeWidth := Max(TreeWidth, tv.Canvas.TextWidth(v0) + 50);
while (v0 = Fields[0].AsString) and not eof do begin
v1 := Fields[1].AsString;
TreeWidth := Max(TreeWidth, 65 + tv.Canvas.TextWidth(v1));
tv.Items.AddChild(n, Fields[1].AsString);
next;
end;
end;
end else begin
while not eof do begin
v0 := fields[0].AsString;
n := tv.Items.AddChild(Nil, v0);
v1 := '';
v2 := '';
// Now check.
while (v0 = Fields[0].AsString) and not eof do begin
v1 := Fields[1].AsString;
n := tv.Items.AddChild(n, v1);
v2 := '';
while (v1 = Fields[1].AsString) and not eof do begin
if (v2 <> fields[2].AsString) then begin
tv.Items.AddChild(n, fields[2].AsString);
v2 := fields[2].AsString;
TreeWidth := Max(TreeWidth, 85 + tv.Canvas.TextWidth(v2));
end;
next;
end;
n := n.Parent;
end;
end;
end;
end;
tv.Width := TreeWidth;
tv.Visible := True;
end;
PassHours
Contributor
4322 Points
736 Posts
Re: please this convert in asp.net
Sep 16, 2010 06:53 AM|LINK
What kind of conversion you are looking for and for what purpose.
Simply saying "please convert this in asp.net" doesn't mean anything
Please be specific.
We make a living by what we get, but we make a life by what we give.
::: Winston Churchill :::
sneha.
Member
123 Points
33 Posts
Re: please this convert in asp.net
Sep 16, 2010 07:03 AM|LINK
Hey specify the format you want to convert. If you want it in c# check for online conversion tools from vb to c#.
Rituranjan
Participant
1231 Points
1279 Posts
Re: please this convert in asp.net
Sep 16, 2010 10:14 AM|LINK
my friend write a Pascal for tree view code but i require in asp.net C# how do it