Prof-UIS supports fade-in/fade-out animation of toolbar buttons. This feature is related to any CExtControlBar
-derived class and widely used in CExtRibbonPage
and CExtRibbonBar
classes. The fading button animations are provided by CExtAnimationSite
and CExtAnimationClient
classes. Each toolbar/ribbon bar button is animation client when any CExtControlBar
class is animation site. Animation clients are allocating timers with dynamic timer numbers in range returned by CExtAnimationSite::AnimationSite_TimerGetBaseID()
and CExtAnimationSite:: AnimationSite_TimerGetMaxID ()
. By default these methods are using the range defined by the following constants:
#define __EXT_MFC_DEF_ANIMATION_TIMER_BASE_TIMER_ID 8700
#define __EXT_MFC_DEF_ANIMATION_TIMER_MAX_TIMER_ID ( __EXT_MFC_DEF_ANIMATION_TIMER_BASE_TIMER_ID + 1000 - 1 )
When you are moving mouse over ribbon bar with animated buttons, the ribbon bar window receives big number of
WM_TIMER
messages and thread idle state is usually not reached until mouse movement is stopped and all the active button animations become finished. We believe this is the real source of the problem. If you invoke the following code, then all the controls will stop using animations and the problem should disappear:
CExtPaintManager::g_DefAnimationParametersNormal.AnimationClient_StepCountSet( 0 );
CExtPaintManager::g_DefAnimationParametersSlow.AnimationClient_StepCountSet( 0);
CExtPaintManager::g_DefAnimationParametersVerySlow.AnimationClient_StepCountSet( 0 );
CExtPaintManager::g_DefAnimationParametersVerySlowAndSmooth.AnimationClient_StepCountSet( 0 );
In you invoke the following code, the all the animations will become restored:
CExtPaintManager::g_DefAnimationParametersNormal.AnimationClient_StepCountSet ( __EXT_MFC_DEF_ANIMATION_STEP_COUNT );
CExtPaintManager::g_DefAnimationParametersSlow.AnimationClient_StepCountSet ( __EXT_MFC_DEF_ANIMATION_STEP_COUNT+1 );
CExtPaintManager::g_DefAnimationParametersVerySlow.AnimationClient_StepCountSet ( __EXT_MFC_DEF_ANIMATION_STEP_COUNT+2 );
CExtPaintManager::g_DefAnimationParametersVerySlowAndSmooth.AnimationClient_StepCountSet ( 4 );
We should note doing heavy work during timer processing in main application’s UI thread is not a good idea. Heavy often occurred operations should be implemented in other thread(s).