Autor Beitrag
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: So 29.02.04 17:54 
Hi Forum,

ich möchte zur Laufzeit ein TWebBrowser erstellen, kann der Kompo aber keinen Namen zuweisen: "Einer Nur-Lesen-Eigenschaft kann kein Wert zugewiesen werden"

Mein Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
with TWebBrowser.Create(ParentTabSheet) do begin
  Name:=MyWebBrowser;
  Navigate('www.irgendwas.de');
end;


Wieso funzt das nicht?

Gruß, jjturbo

Moderiert von user profile iconDeCodeGuru: Delphi-Tags hinzugefügt

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 29.02.04 20:00 
Zitat:
Wieso funzt das nicht?

Weil TWebBrowser (bzw. IWebBrowser) die Eigenschaft Name, Parent usw. neu deklariert,
hat man keinen Zugriff auf die von TOleControl geerbten Eigenschaften.

Probier's so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button1Click(Sender: TObject);
var
 wb: TWebBrowser;
begin
  wb := TWebBrowser.Create(Form1);
  TWinControl(wb).Name := 'MyWebBrowser';
  TWinControl(wb).Parent := Form1;
  wb.Navigate('www.google.de');
end;
jjturbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: So 29.02.04 20:23 
Ja, so schnackelts.

Danke, jjturbo :D

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...