IanF
IanF

Reputation: 45

Deplhi TEmbeddedWB check if element is visible

I have EmbeddedWB component on Delphi form, and using it as webbrowser for different pages.

is there some way to check, if IHTMLelement is displayed or not? I know about ihtmlelement.style.display property, and when it's set to 'none', then the element is not visible. But what , if its parentelement, or parentelement's parentelement (etc etc...) is hidden?

Can i check somehow, if it's visible?

my code - that not works properly

var
document:ihtmldocument2;
body:ihtmlelement2;
i:integer;
tag:ihtmlelement;
tags:IHTMLElementCollection;

...

document:=embeddedwb.document as ihtmldocument2;
body:=document.body as ihtmlelement2;

if assigned(body) then begin

  Tags := Body.getElementsByTagName('*');

  for i := 0 to Tags.length-1 do
  begin

  try
    Tag := Tags.item(I, EmptyParam) as IHTMLElement;
    except
   tag:=nil;
    end;
  if tag.style.display<>'none' then begin
// this condition is not good, because the tag.style.display is usually set to '' so it not telling me, if the tag is really visible or not...
...


...

thanks for suggestions

Upvotes: 0

Views: 472

Answers (1)

IanF
IanF

Reputation: 45

ok I solved it...

added variable tag2: IHTMLElement2;

tag2:=tag as ihtmlelement2;

if tag2.currentstyle.display<>'none' then  ...

solved my problem

Upvotes: 1

Related Questions