Autor Beitrag
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mi 08.03.06 16:32 
Hallo,

ich steh heute irgendwie auf dem Schlauch :?

Das Element hat den Namen "Suchenach", mit
ausblenden Delphi-Quelltext
1:
Document.Forms.Item(0).Suchenach.Focus;					

kann ich den Focus setzen,
aber wie kann ich herrausfinden welches Form-Element in der geladenen Seite den Focus hat?
Wäre nett, wenn mir da Jemand helfen könnte.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Lannes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 09.03.06 14:27 
Hallo,

ich glaub ich hab es geschafft, :wink:
activeElement war das Stichwort.

der erste Versuch:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var aOleObj : OleVariant;
//...
aOleObj := WebBrowser1.OleObject.document.Frames.Item('Oben').Document;
if aOleObj.selection.type = 'Text' then
  begin
  if aOleObj.Selection.CreateRange.parentElement.tagName = 'INPUT' then
    if aOleObj.Selection.CreateRange.parentElement.Name = 'Suchenach' then
      aOleObj.Forms.Item(0).Absendeknopf.Click;
  end;

Das funktionierte leider nur wenn in dem Input-Element etwas markiert ist.


Das funktioniert, zumindest bis jetzt:
(das 'INPUT'-Element 'Suchenach' befindet sich im Frame 'Oben')
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var aOleObj : OleVariant;
//...
if WebBrowser1.OleObject.document.activeElement.Name = 'Oben' then
  begin
  aOleObj := WebBrowser1.OleObject.document.Frames.Item('Oben').Document;
  if aOleObj.activeElement.TagName = 'INPUT' then
    if aOleObj.activeElement.Name = 'Suchenach' then
      begin
      //showmessage(aOleObj.activeElement.Name);
      aOleObj.Forms.Item(0).Absendeknopf.Click;
      end;
  end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )