Isn't this code a bit too simple??
Posted: Mon May 11, 2009 4:39 pm
Since I didn't get a hit searching for a sentence I know is present in the tree I looked at the find-code:
Function TNodeShapeList.Find(Const S:String; Partial:Boolean=False):TTreeNodeShape;
var t : Integer;
begin
for t:=0 to Count-1 do
if ((not Partial) and (Items[t].SimpleText=S)) or
((Partial) and (Pos(S,Items[t].SimpleText)>0)) then
begin
result:=Items[t];
exit;
end;
result:=nil;
end;
Shouldn't there be a folding of each side of the here, either to lower case or to upper case.
The code above do only work if you ahead know the exact folding
Maybe some other compare function also could be used ??
Function TNodeShapeList.Find(Const S:String; Partial:Boolean=False):TTreeNodeShape;
var t : Integer;
begin
for t:=0 to Count-1 do
if ((not Partial) and (Items[t].SimpleText=S)) or
((Partial) and (Pos(S,Items[t].SimpleText)>0)) then
begin
result:=Items[t];
exit;
end;
result:=nil;
end;
Shouldn't there be a folding of each side of the here, either to lower case or to upper case.
The code above do only work if you ahead know the exact folding
Maybe some other compare function also could be used ??