nnbbb09
asked on
Outlook 2000 Effect
Hello,
I'm trying to achieve the same effect that Outlook 2000 creates when the user clicks the find button. ie : There is a piece of smooth animation as the inbox shrinks and the find panel enlarges.
I've tried the following code below (the form is basically a TPanel aligned top and a TListView aligned client) but it flickers a lot. Any ideas?
while i <= Max(pnlSearch.Height,250) do
begin
pnlSearch.Height:=i;
self.Update; //without this it looks even worse
Sleep(20);
inc(i,12);
end;
Thanks
Jo
I'm trying to achieve the same effect that Outlook 2000 creates when the user clicks the find button. ie : There is a piece of smooth animation as the inbox shrinks and the find panel enlarges.
I've tried the following code below (the form is basically a TPanel aligned top and a TListView aligned client) but it flickers a lot. Any ideas?
while i <= Max(pnlSearch.Height,250) do
begin
pnlSearch.Height:=i;
self.Update; //without this it looks even worse
Sleep(20);
inc(i,12);
end;
Thanks
Jo
Hi,
Try this !
Procedure Delay(mSeconds : Cardinal);
Var
mSecStart : Cardinal;
Begin
mSecStart := GetTickCount;
While mSeconds > (GetTickCount - mSecStart) do Application.ProcessMessage s;
End;
...
while i <= Max(pnlSearch.Height,250) do
begin
pnlSearch.Height:=i;
delay(20);
end;
...
GL
Bug
Try this !
Procedure Delay(mSeconds : Cardinal);
Var
mSecStart : Cardinal;
Begin
mSecStart := GetTickCount;
While mSeconds > (GetTickCount - mSecStart) do Application.ProcessMessage
End;
...
while i <= Max(pnlSearch.Height,250) do
begin
pnlSearch.Height:=i;
delay(20);
end;
...
GL
Bug
Tried it but I didn't find an answer ... just a thought, I think it is the Listview that is your main problem with flickering, maybe you should not repaint it all the time but rather not repaint it until the size change is finished.
ASKER
Sorry for the delay in responding. I've tried all 3 approaches ie : ProcessMessages, using bugroger's timer and also disabling updates for the ListView but I still can't achieve the desired effect. I think I'll just revert to making the panel visible/invisible rather than trying to animate it.
Any objections to me deleting this question?
Thanks for your input anyway
Jo
Any objections to me deleting this question?
Thanks for your input anyway
Jo
On Torry's (www.torry.ru), there is a small component called TFlickerFreePaintBox.
I tried it yesterday and it worked like a charm.
You might want to download it and check it out. Although I don't know if you will be able to use the component directly for your purpose, but you might be able to learn something from the source code (it s very short).
I tried it yesterday and it worked like a charm.
You might want to download it and check it out. Although I don't know if you will be able to use the component directly for your purpose, but you might be able to learn something from the source code (it s very short).
ASKER
Decided to scrap the idea from the project and will just make the panel visible/invisible. Tried the suggestions (and combinations of them) but with no success.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Application.ProcessMessage
somewhere in your loop if you're going to call Sleep.