Link to home
Start Free TrialLog in
Avatar of nnbbb09
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
Avatar of scrapdog
scrapdog
Flag of United States of America image

I tried similar code and didn't notice any flickering.  I don't know how to help you out, but I would suggest that you place

Application.ProcessMessages

somewhere in your loop if you're going to call Sleep.
Avatar of bugroger
bugroger

Hi,

Try this !

Procedure Delay(mSeconds : Cardinal);
Var
 mSecStart : Cardinal;

Begin
 mSecStart := GetTickCount;
 While mSeconds > (GetTickCount - mSecStart) do Application.ProcessMessages;
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.
Avatar of nnbbb09

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
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).
Avatar of nnbbb09

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
Avatar of ComTech
ComTech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial