Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi SetFocus in Webbrowser ? (https://www.delphipraxis.net/116173-setfocus-webbrowser.html)

taktaky 24. Jun 2008 16:44


SetFocus in Webbrowser ?
 
Hallo

wie mach ich Focus in eine bestimmte Feld in Webbrowser ?

mit javascript ist :

Delphi-Quellcode:
<script type="text/javascript" language="JavaScript">
document.forms['myform'].elements['Felde1'].focus();
</script>

sirius 24. Jun 2008 16:49

Re: SetFocus in Webbrowser ?
 
Ich würde ja vermuten, dass dieses DispatchInterface auch in Delphi so funktioniert. Hast du das schon probiert?

toms 24. Jun 2008 17:00

Re: SetFocus in Webbrowser ?
 
Hallo

Mir sind zwei Möglichkeiten bekannt.

1.

Delphi-Quellcode:
uses
  ActiveX;

  with WebBrowser1 do
  if Document <> nil then
    with Application as IOleobject do
      DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser1, 0, Handle,
        GetClientRect);
end;
{2}

Delphi-Quellcode:
uses
  MSHTML;

begin
  if WebBrowser1.Document <> nil then
  (Webbrowser1.Document as IHTMLDocument2).ParentWindow.Focus;
end;
PS: Viele Antworten auf Fragen findest du schon via DP Suche oder via Google: Bei Google suchenFocus Webbrowser

taktaky 24. Jun 2008 17:40

Re: SetFocus in Webbrowser ?
 
Und wie kann ich den Focus in ein Feld zuweisen, so das er drinnen blinkt ?

Die Muhkuh 24. Jun 2008 17:45

Re: SetFocus in Webbrowser ?
 
Wahrscheinlich genau wie beim JavaScript auch. Siehe sirius' Kommentar, dessen Vermutung ich teile.

toms 24. Jun 2008 19:33

Re: SetFocus in Webbrowser ?
 
Zitat:

Zitat von taktaky
Und wie kann ich den Focus in ein Feld zuweisen, so das er drinnen blinkt ?

Delphi-Quellcode:
Webbrowser1.OleObject.Document.All.Item('Hier_FeldName_einsetzen').Focus;

taktaky 24. Jun 2008 19:59

Re: SetFocus in Webbrowser ?
 
Danke Toms

Zitat:

Zitat von sirius
Ich würde ja vermuten, dass dieses DispatchInterface auch in Delphi so funktioniert. Hast du das schon probiert?

DispatchInterface ! kenne ich leider nicht aus :(

gruß


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:02 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-2025 by Thomas Breitkreuz