|
Problem (1)
Here is the fixed code.
function TWebBrowserMainForm.FillBLASTForm: boolean;
var
i, j: Integer;
FormItem: Variant;
begin
result := false;
if WebBrowser1.Document = nil then exit;
if pos('BLAST', uppercase(WebBrowser1.LocationURL)) = 0 then exit;
if WebBrowser1.OleObject.Document.forms.Length = 0 then exit;
for i := 0 to WebBrowser1.OleObject.Document.forms.Length - 1 do
begin
FormItem := WebBrowser1.OleObject.Document.forms.Item(i);
for j := 0 to FormItem.Length - 1 do
if FormItem.Item(j).tagName = 'TEXTAREA' then
if uppercase(FormItem.Item(j).Name) = 'QUERY' then
begin
if BLASTSequence <> '' then
FormItem.Item(j).Value := BLASTSequence;
FormItem.Item(j).focus;
result := true;
Exit;
end;
end;
end;
Problem (2)
Here is the fixed code.
procedure TSeqNameOptionDlgForm.FormShow(Sender: TObject);
begin
CurFormat := FormatRdGp.ItemIndex;
CurSpecies := SpeciesRdGp.ItemIndex;
CurGene := GeneRdGp.ItemIndex;
CurUseInitial := UseInitialCkBx.Checked;
SpeciesRdGp.Enabled := ((species <> '') and (strain <> '')) or ((host <> '') and (senotype <> ''));
UseInitialCkBx.Enabled := (species <> '') or (host <> '');
GeneRdGp.Enabled := (gene <> '') and (allele <> '');
FormatRdGp.Enabled := (species+strain+host+senotype <> '') and (gene+allele <> '');
SetSeqNameEdit;
end;
Problem(3)?
It is not a bug, but I have improved the source code for such power users.
First, move procedure SetSeqNameEdit from private to public.
public
{ Public declarations }
species,strain,gene,allele,GI,host,senotype: string;
procedure SetSeqNameEdit;
end;
Second, replace the corresponding part (near the end) of procedure TWebBrowserMainForm.FetchActionExecute(Sender: TObject) with the following.
i := 0;
while i < sl.Count do
begin
SeqNameOptionDlgForm.species := sl[i].Species;
SeqNameOptionDlgForm.strain := sl[i].Strain;
SeqNameOptionDlgForm.host := sl[i].Host;
SeqNameOptionDlgForm.senotype := sl[i].Senotype;
SeqNameOptionDlgForm.gene := sl[i].Gene;
SeqNameOptionDlgForm.allele := sl[i].Allele;
SeqNameOptionDlgForm.GI := sl[i].UIDS;
SeqNameOptionDlgForm.infomemo.Lines[0] := sl[i].SeqInfo;
SeqNameOptionDlgForm.SeqNameEdit.Text := sl[i].SeqName;
if i = 0 then
if SeqNameOptionDlgForm.ShowModal = mrOK then
begin
sl[i].SeqName := SeqNameOptionDlgForm.SeqNameEdit.Text;
AlignEditMainForm.AlignGrid1.AppendSequence(sl[i]);
AlignEditMainForm.Visible := true;
sl[i] := nil;
inc(i);
end
else
break
else
begin
SeqNameOptionDlgForm.SetSeqNameEdit;
flag := true;
for j := 0 to AlignEditMainForm.AlignGrid1.NoOfSeqs-1 do
if SeqNameOptionDlgForm.SeqNameEdit.Text = AlignEditMainForm.AlignGrid1.Sequence[j].SeqName then
begin
flag := false;
n := j;
break;
end;
if not flag then
begin
MessageDlg('The specified sequence name already exists. Please modify it.', mtInformation, [mbOK], 0);
AlignEditMainForm.AlignGrid1.Select(0,n,0,n);
AlignEditMainForm.AlignGrid1.SelectSequence;
AlignEditMainForm.SetFocus;
if SeqNameOptionDlgForm.ShowModal = mrOK then
begin
sl[i].SeqName := SeqNameOptionDlgForm.SeqNameEdit.Text;
AlignEditMainForm.AlignGrid1.AppendSequence(sl[i]);
AlignEditMainForm.Visible := true;
sl[i] := nil;
inc(i);
end
else
break;
end
else
begin
sl[i].SeqName := SeqNameOptionDlgForm.SeqNameEdit.Text;
AlignEditMainForm.AlignGrid1.AppendSequence(sl[i]);
AlignEditMainForm.Visible := true;
sl[i] := nil;
inc(i);
end;
end;
end; |
|