Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Usage statistics in Expandable menu Collapse All
Subject Author Date
Andrea Colugnat Nov 16, 2006 - 5:27 AM

How it works the usage statistics or the number of clicks to decide to hide a Menu Item ?
How much time of not usage of a menu item the system needs ?
Is it configurable ?

Thanks

Regards

Technical Support Nov 18, 2006 - 10:39 AM

Both toolbar buttons and menu items invoke the following virtual method of the CExtCmdItem object stored in the CExtCmdProfile command profile object inside the command manager (the CExtCmdManager object controlled by the g_CmdManager global smart pointer variable):

virtual CExtCmdItem::Deliver( HWND hWndCmdTarget, bool bSend = false );
This method sends/posts the WM_COMMAND message and increments the command usage number of the CExtCmdItem object by invoking the following method:
virtual void CExtCmdItem::IncrementUsageCount();
The following virtual methods return the number of command invocations count and the percent of all command invocations:
virtual void CExtCmdItem::GetUsageTickCount() const; 
virtual void CExtCmdItem::GetUsagePercent() const;
The CExtCmdItem::GetUsagePercent() virtual method operates with the number of the command invocations and count of invocations of all the CExtCmdItem command objects stored in the same CExtCmdProfile command profile object. This is possible because the CExtCmdItem::m_pCmdProfile property stores a pointer to the CExtCmdProfile command profile object and allows command objects to know their command profiles.

Here is how the command invocations is counted. A command is initially visible in popup menus in two cases:

1) The command has been marked as basic and the CExtCmdItem::StateIsBasic() virtual method returns true.

2) The CExtCmdItem::StateIsRarelyUsed() virtual method returns false.

The CExtCmdItem::StateIsRarelyUsed() virtual method considers the command as frequently used if the usage percent for the CExtCmdItem command object is greater or equal to CExtCmdProfile::m_nRarelyPercent. So, the simplest way is to change the CExtCmdProfile::m_nRarelyPercent value, which is by default set to 10. But you could also implement your own CExtCmdItem-derived and CExtCmdProfile-derived classes. In this case, you should override GetUsagePercent() and StateIsRarelyUsed() virtual methods of CExtCmdItem and the OnCreateCmdItem() virtual method of CExtCmdProfile. The latter instantiates objects of your CExtCmdItem-derived class. The CExtCmdProfile::ProfileSetup() method allows you to specify your own implementation of the CExtCmdProfile-derived class.