I am not sure if this is a bug or if the component itself must be visible for it to work properly because it is a TCustomControl which is a WindowedControl. Anyway, this resolves the problem:
procedure TForm2.btnCountVisibleThumbsClick(Sender: TObject);
var
i: Integer;
VisibleThumbs: Integer;
begin
if pgc1.ActivePageIndex = 0 then
begin
pgc1.ActivePageIndex := 1;
ImageEnMView1.ViewY := 0; // show first row
VisibleThumbs := -1;
for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
if not ImageEnMView1.IsVisible(i) then
begin
VisibleThumbs := i;
BREAK;
end;
pgc1.ActivePageIndex := 0;
end;
end
else
begin
VisibleThumbs := -1;
for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
if not ImageEnMView1.IsVisible(i) then
begin
VisibleThumbs := i;
BREAK;
end;
end;
end;
lblVisibleThumbs.Caption := 'Visible thumbs (even partially visible): ' + IntToStr(VisibleThumbs);
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development