"Pin to top" vs "Pin to view"

Example script that adds a dynamic button-menu to a toolbar: