![]() |
Gecko Interface nutzen...
Ich hab absolut keine Ahnung, wie ich mit interfaces arbeiten muss ^^
Also: ich habe mir das ![]() ![]() Nun zu meinem Problem: Ich möchte gerne Klicks auf Links abfangen. Die TGeckoBrowser Komponente bietet zwar "OnLocationChange", das wird aber erst nach dem Laden ausgelöst. Ich möchte den Klick schon vorher abfangen und dann selber behandeln. Nach viel Gesuche bin ich auf das Interface ![]() Ich möchte noch dazu sagen, dass ich bisher noch nie selbst Interfaces implementieren musste, ich hatte immer fertige Vorlagen ;) Mein Codeversuch:
Delphi-Quellcode:
Nunja, funktioniert genau gar nicht :P
type
nsIContentPolicy = interface(nsISupports) ['{58cf9dca-40b3-6211-a508-7351f437a53e}'] function shouldLoad(aContentType: Cardinal; aContentLocation: nsIURI; aRequestOrigin: nsIURI; aContext: nsISupports; aMimeTypeGuess: nsISupports; aExtra: nsISupports): Cardinal; stdcall; function shouldProcess(aContentType: Cardinal; aContentLocation: nsIURI; aRequestOrigin: nsIURI; aContext: nsISupports; aMimeType: nsISupports; aExtra: nsISupports): Cardinal; stdcall; end; TGeckoBrowserEx = class(TGeckoBrowser,nsIContentPolicy) private function shouldLoad(aContentType: Cardinal; aContentLocation: nsIURI; aRequestOrigin: nsIURI; aContext: nsISupports; aMimeTypeGuess: nsISupports; aExtra: nsISupports): Cardinal; stdcall; function shouldProcess(aContentType: Cardinal; aContentLocation: nsIURI; aRequestOrigin: nsIURI; aContext: nsISupports; aMimeType: nsISupports; aExtra: nsISupports): Cardinal; stdcall; end; const REJECT_REQUEST = -1; REJECT_TYPE = -2; REJECT_SERVER = -3; REJECT_OTHER = -4; ACCEPT = 1; var Form1: TForm1; GeckoBrowser1: TGeckoBrowserEx; implementation function TGeckoBrowserEx.shouldLoad(aContentType: Cardinal; aContentLocation: nsIURI; aRequestOrigin: nsIURI; aContext: nsISupports; aMimeTypeGuess: nsISupports; aExtra: nsISupports): Cardinal; begin Form1.Memo1.Lines.Add('asdf'); // zum Überprüfen, dass die Methode auch ausgeführt wurde :P In diesem Fall würde jetzt das Laden erlaubt... Result:=ACCEPT; end; function TGeckoBrowserEx.shouldProcess(aContentType: Cardinal; aContentLocation: nsIURI; aRequestOrigin: nsIURI; aContext: nsISupports; aMimeType: nsISupports; aExtra: nsISupports): Cardinal; begin Result:=ACCEPT; end; procedure TForm1.FormShow(Sender: TObject); begin GeckoBrowser1:=TGeckoBrowserEx.Create(self); GeckoBrowser1.Parent:=Form1; GeckoBrowser1.Show; GeckoBrowser1.Top:=8; GeckoBrowser1.Left:=8; GeckoBrowser1.Width:=1200; GeckoBrowser1.Height:=472; GeckoBrowser1.LoadURI('http://www.google.com/'); // oder was auch immer, wo halt Links sind, die ich abfangen kann ^^ end; Wie muss ich das machen? :) MfG Z4ppy |
AW: Gecko Interface nutzen...
![]() Das Delphi Gecko SDK wird benötigt (GeckoComponents und GeckoSDK aus dem Archiv) ;) Der Link dorthin findet sich oben... Vielleicht kann mir so besser geholfen werden, wenn mir noch zu helfen ist ^^ MfG Z4ppy |
AW: Gecko Interface nutzen...
Ich habe im MDC (Mozilla Development Center ^^) nun
![]() MfG Z4ppy |
AW: Gecko Interface nutzen...
Kann mir wirklich keiner helfen? :cry:
Das kann doch nicht soo schwer sein... für euch Profis ^^ MfG Z4ppy |
AW: Gecko Interface nutzen...
Ich wollte mich mit dem Thema Gecko immer mal befassen. Hab nur gerade das Webkit am Wickel. Wenn ich das mit Cairo unter Windows kompiliert bekomme, dann schauen wir mal weiter.
Also keine Hektik ;-) |
AW: Gecko Interface nutzen...
Alles klar :)
MfG Z4ppy |
AW: Gecko Interface nutzen...
Ich erlaube mir mal, hier zu bumpen nach knapp 2 Monaten ^^
MfG Z4ppy |
AW: Gecko Interface nutzen...
Ich bin an der Front auch noch nicht weiter, aber du kannst ja mal bei
![]() Dort wird das SDK für Delphi weiter entwickelt. Der letzte commit war allerdings vor 516 Tagen. |
AW: Gecko Interface nutzen...
Das ist das, was ich schon verwende, und dort wird leider auf dieses Interface gar nicht eingegangen :( Scheint für den Normalbenutzer nicht wichtig genug zu sein...
MfG Z4ppy |
AW: Gecko Interface nutzen...
Hallo
hätte mal ne Frage: wie kann ich denn die originale Gecko SDK in die Delphi Gecko SDK integrieren? LG R2D2-AEG |
AW: Gecko Interface nutzen...
Du lädst dir von
![]() Die Frage des Threads ist leider nach wie vor unbeantwortet :cry: MfG Z4ppy |
AW: Gecko Interface nutzen...
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz