You can modify the master of folder.w. It's in src/adm2/folder.w. You just add the function, ship it out with your application as normal, and then every screen which uses folder.w will have access to your fantastic new function! It's the very essence of object orientation.
If you're not up to modifying the master smartObjects, then there's nothing you can do other than keep track of which pages you enable/disable in some other way, like storing the page context in the folder's parent container in some fashion (temp-table or extent variable).