Animating clarion windows

I have tried to animate the opening of a window by using a routine changing the height of the form using a timer.
The problem is that clarion is too fast, so the progressive opening effect is lost.
Has anybody else tried this and got it to work?

My intention is to have windows opening from the top, or sliding in from the left or right, to give the application a more modern look.

Hi Werner,
This can be best achieved using AnimateWindow windows api.

!Inside global map:
MODULE(‘user32’)
AnimateWindow(HWND,DWORD,DWORD),BOOL,PASCAL,RAW
END

!Before Global Includes
AW_HOR_POSITIVE EQUATE(1o)
AW_HOR_NEGATIVE EQUATE(2h)
AW_VER_POSITIVE EQUATE(4h)
AW_VER_NEGATIVE EQUATE(8h)
AW_CENTER EQUATE(10h)
AW_HIDE EQUATE(10000h)
AW_ACTIVATE EQUATE(20000h)
AW_SLIDE EQUATE(40000h)
AW_BLEND EQUATE(80000h)
HWND EQUATE(LONG)
DWORD EQUATE(ULONG)

!Calling:
AnimateWindow(0{PROP:Handle},1000,AW_HIDE+AW_BLEND)
! OR
AnimateWindow(0{PROP:Handle},1000,AW_ACTIVATE+AW_BLEND)

This should give you a good start. Unfortunately, I do not have a working example.

Regards

Mathew

There’s more stuff about animatewindow here https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-animatewindow

But with the caveat: Just because you CAN animate, doesn’t mean that you SHOULD :slight_smile:
Its lustre can wear off pretty quickly, IMO.

1 Like

I tried AnimateWindow some years ago, the code in window procedure looks like this:

!  OF WM_SHOWWINDOW
!    wh::DebugInfo('WM_SHOWWINDOW')
!  
!    IF SELF.animation.dwTime AND SELF.animation.dwFlags
!      wh::AnimateWindow(SELF.W{PROP:Handle}, SELF.animation.dwTime, SELF.animation.dwFlags)
!!      wh::AnimateWindow(SELF.W{PROP:Handle}, SELF.animation.dwTime, AW_ACTIVATE + SELF.animation.dwFlags)
!    END

  OF WM_CLOSE
    SELF.Close()

    IF SELF.animation.dwTime AND SELF.animation.dwFlags
      wh::AnimateWindow(SELF.W{PROP:Handle}, SELF.animation.dwTime, AW_HIDE + SELF.animation.dwFlags)
    END

WM_SHOWWINDOW branch is commented out because I could not make AnimateWindow to work on window opening. On closing it works, but IIRC only for non-MDI windows.