Problems with Slide in/out Effect on Form lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- dbcbos · 2012-02-28 21:08 Hi People, I'm trying too make a simple slide in/out effect after I press a button the form's Height is extended. Press it again and it returns to the original height. Problem is with this code the form top for some reason flickers a few pixels higher and after the animation it returns to its original position. Anyone knows a solution too that? Here is the code behind the button. procedure TfrmLogin.butOptionsClick(Sender: TObject); var   R: TRect;   h: integer; begin      if t then      begin         t:=false;         R:=BoundsRect;         h:=ClientHeight;         repeat            //InflateRect(R,0,-5);            //BoundsRect := R;            h := h - 10;            ClientHeight := h;          until ClientHeight <= 200;      end      else      begin        t:=true;        R:=BoundsRect;        h:=ClientHeight;        repeat           //InflateRect(R,0,5);           //BoundsRect := R;           h := h + 10;           ClientHeight := h;         until ClientHeight >= 400;      end; end; Explanation: t is a global boolean variable to check if the button has been pressed before or not. I also tried to use BoundsRect and InflateRect. Unfortunately the effect then is that it doesn't slide down, but up and down. I only want down. ---------------------------------------------------------------------- Shebuka · 2012-02-29 09:06 try with self.Heght += 10 ---------------------------------------------------------------------- User137 · 2012-02-29 10:01 Quote from: dbcbos on February 28, 2012, 10:08:14 pmProblem is with this code the form top for some reason flickers a few pixels higher and Weird, i tried your code in new project, on a TButton click. No flickering. Windows 7, 32bit. Also, that kind of animation scales with CPU speed. So slow computers have slow animation, and fast computers may do it so fast it's hardly noticable. ---------------------------------------------------------------------- dbcbos · 2012-02-29 10:06 Unfortunately that has the same effect. I think it may be a bug. Anyone tried out my code for themselves and see what effect it had? Note if I set the Borderstyle form property to bsnone. It works as it should, but I lose the close, minimize and maximize buttons then ofcourse. So not really a solution. Might this also be a carbon issue? @User137: If you've got an alternative, I'm open for that. ---------------------------------------------------------------------- Shebuka · 2012-02-29 13:56 tested on Mac OS X 10.6.8, SVN Lazarus, 4.6.0 FPC, same issue. btw try use timer to make this animation, it will be same speed on all cpu speeds AND your interface will not be blocked during animation execution.