procedure TMainForm.StartFindSubject(AIndex:integer);
var
i:Integer;
lSubject:string;
lTask: TTask;
// lNode: TTreeListNode;
lIsSelect:Boolean;
begin
lIsSelect:=False;
for i:=AIndex to gltTasks.Count-1 do
begin
lTask:=TTask(gltTasks.Items.Data);
lSubject:= lTask.Subject;
if FTaskSubject<>'' then
begin
if StringUtils.Pos(FTaskSubject, lSubject)>0 then
begin
gltTasks.Items.Focused:=True;
lIsSelect:=True;
actFindNext.Enabled:=True;
FFindIndex:=i;
exit;
end;
end;
end;
if not lIsSelect then
begin
actFindNext.Enabled:=False;
Dialogs.ShowMessage('没有查询到此主题!');
end;
end;
procedure TMainForm.actSubjectExecute(Sender: TObject);
var
lSubjectQueryForm:TSubjectQueryForm;
begin
Inherited;
lSubjectQueryForm:=TSubjectQueryForm.Create(Self.Context);
try
if lSubjectQueryForm.ShowModal=Business.Forms.Controls.mrOK then
begin
FTaskSubject:=lSubjectQueryForm.edtTaskSubject.Text;
StartFindSubject(0);
end;
finally
lSubjectQueryForm.Free;
end;
end;
procedure TMainForm.actFindNextExecute(Sender: TObject);
begin
Inherited;
StartFindSubject(FFindIndex+1);
end;