Thema: Delphi Selectfeld ändern

Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#2

Re: Selectfeld ändern

  Alt 13. Apr 2008, 15:30
Hallo Dominik,

Hier mal eine Möglichkeit:

 if WB_SetSelectValue(Webbrowser1, 'MVLG', 'Kontodaten') then // ok
Delphi-Quellcode:
function WB_SetSelectValue(WB: TWebbrowser; SelectName, ItemName: string): boolean;
var
  iForms, iFormItems, iSelectItems: Word;
  FormItem: OleVariant;
begin
  Result := False;
  for iForms := 0 to WB.OleObject.Document.forms.Length - 1 do
  begin
    FormItem := WB.OleObject.Document.forms.Item(iForms);
    for iFormItems := 0 to FormItem.Length - 1 do
    begin
      if (FormItem.Item(iFormItems).type = 'select-one') and
        (FormItem.Item(iFormItems).Name = SelectName) then
      begin
        for iSelectItems := 0 to FormItem.Item(iFormItems).Options.Length - 1 do
        begin
          if SameText(FormItem.Item(iFormItems).Options.Item(iSelectItems).Text, ItemName) then
          begin
            FormItem.Item(iFormItems).SelectedIndex := iSelectItems;
            Result := True;
            Break;
          end;
        end;
      end;
    end;
  end;
end;
Thomas
  Mit Zitat antworten Zitat