Forum
Grundkurs
»Introduktion
»Snabbguide
»Komponenter
»Händelser
»Strängar
»Räkna med Delphi »Egna
typer
»Selektion
»Iteration
»Menyer
»Funktioner
»Arraystrukturer
Tips & Tricks
»Nya tips
»Blandat
»Databaser
»Filer
»Forms
»Grafik
»Internet
»Komponenter
»Matematik
»Multimedia
»Objekt/ActiveX
»Skrivare
»Strängar
»System
»Mest lästa tips
Artiklar
»Delphi och ADO
»Bygga en DLL
»Skapa en enkel rapport
»Hantera registret
»Enheter, units
»Klassen TCanvas
»Använd LookUp Controls
Nya
tips
Lägg
till tips
Delphilänkar
Gästbok
|
|
|
|
Få tillgång till radioknappar i en TWebBrowser
|
Kategori: Internet
Inlagt: 2004-11-22
Läst: 1215
Inlagt av: Staffan Berg
|
Beskrivning |
Detta exempel gör det möjligt att accessa radioknappar som är laddade i en TWebBrowser.
|
Kod |
procedure TForm1.Button1Click(Sender: TObject); var Document: IHTMLDocument2; rbTestList: IHTMLElementCollection; rbTest: IHTMLOptionButtonElement; I: Integer; begin // Get a reference to the document Document := WebBrowser1.Document as IHTMLDocument2; // Get a reference to input-control (Radiobutton) rbTestList := Document.all.item('rating', EmptyParam) as IHTMLElementCollection; // Get current values. for I := 0 to rbTestList.Length - 1 do begin // reference to the i. RadioButton rbTest := rbTestList.item(I, EmptyParam) as IHTMLOptionButtonElement; // Show a message if radiobutton is checked if rbTest.Checked then ShowMessageFmt('Der RadioButton mit dem Wert %s' + ' ist ausgewählt!', [rbTest.Value]); end; // Set new values for I := 0 to rbTestList.Length - 1 do begin // reference to the i. RadioButton rbTest := rbTestList.item(I, EmptyParam) as IHTMLOptionButtonElement; // check radiobutton with value 3. if rbTest.Value = '3' then rbTest.Checked := True; end; end;
|
|
|