Show / Hide File Extensions

If you want to 'toggle' whether or not the Name column shows extensions, try this:

Step 1. Create two new STYLES (Settings - Preferences - Listers - Styles):

Create a style with the name ExtOFF:
Click the New Style icon and enter the name - Select the Left file display (and/or Right file display) tab
Check Format - Click Edit - Click the display tab - Check view - Check Hide file extension

Create a style with the name ExtON:
Click the New Style icon and enter the name - Select the Left file display (and/or Right file display) tab
Check Format - Click Edit - Click the display tab - Check view - UNCheck Hide file extension

Step 2. Create a left/right click button to load the two new styles:

<?xml version="1.0"?>
<button backcol="none" display="label" textcol="none" type="three_button">
	<label>Ext</label>
	<button backcol="none" display="label" textcol="none">
		<label>OFF</label>
		<tip>Extensions OFF</tip>
		<function type="normal">
			<instruction>Prefs STYLE=&quot;ExtOFF&quot;</instruction>
		</function>
	</button>
	<button backcol="none" display="label" textcol="none">
		<label>ON</label>
		<tip>Extensions ON</tip>
		<function type="normal">
			<instruction>Prefs STYLE=&quot;ExtON&quot;</instruction>
		</function>
	</button>
</button>

Left click the Button to hide file extensions; Right click the Button to show file extensions

1 Like

Hey Christiaan. Great button! Very useful for me as I default hide my extensions but sometimes want to show to change them. Question:
How to I toggle the highlight of the button so that when extensions are shown, the button is highlighted? Is there a way to toggle highlighting with a three button? I've tried experimenting with new @toggle from 9.1.1.8 but to no avail...

Buttons which set styles are never highlighted as "active" so you can't change when this particular button is highlighted.

(This is because styles are never "active", they just get applied. i.e. If you select a style then its settings are applied to the window but Opus doesn't remember that the settings came from that style.)

Buttons which toggle columns on and off are an example of something that is highlighted, though. So this could be a Show Extensions button that is highlighted when extensions are shown and can be clicked to toggle them:

Set COLUMNSTOGGLE=ext(1)

And, in Opus 9.1.1.8, this could be a Hide Extensions button which does the same but is highlighted when extensions are hidden:

@toggle invert
Set COLUMNSTOGGLE=ext(1)

(When I say show extensions, I mean the Ext column. Whether or not extensions are shown as part of the Name column is part of the folder format. But if you usually don't want to see extensions then you could turn them off for everything, and then use one of my buttons to toggle the Ext column on and off when you need it.)

Thanks for the quick reply, Leo. Too bad highlighting can't be done, but it's more of a nice-to-have. Thanks for your button examples. Will try them out. Appreciate all your work and efforts, as always.

Is there any way this code can be edited to auto-size columns after switching from ExtON to ExtOFF and vice versa...?

Great bit of code as it is though.

You should just need to set the autosize option on within the format which each style sets. The option is on the Display tab of the format.

That doesn't work for me. I have auto-size checked for left and right file displays in both ExtON and ExtOFF styles.

Switching styles manually or using the toolbar button doesn't resize the columns.

As Leo wrote, you should just need to set the autosize option on within the styles. :confused:
But when for some reason it doesn't work for you, you could add this code to the button: Set AUTOSIZECOLUMNS=both
I just tried it and it works for me. Your new button-code to show / hide extensions and to auto-size the columns:

<?xml version="1.0"?>
<button backcol="none" display="label" textcol="none" type="three_button">
   <label>Ext</label>
   <button backcol="none" display="label" textcol="none">
      <label>OFF</label> 
      <tip>Extensions OFF</tip>
      <function type="normal">
         <instruction>Prefs STYLE=&quot;ExtOFF&quot;</instruction>
         <instruction>Set AUTOSIZECOLUMNS=both </instruction>
      </function>
   </button>
   <button backcol="none" display="label" textcol="none">
      <label>ON</label>
      <tip>Extensions ON</tip>
      <function type="normal">
         <instruction>Prefs STYLE=&quot;ExtON&quot;</instruction>
         <instruction>Set AUTOSIZECOLUMNS=both </instruction>
      </function>
   </button>
</button>
1 Like

That method certainly works... thanks guys.

That's great but I have the extension column already visible in list view.
What I need is to show the extension in-line when looking at thumbnails.
Is there an option for that or can I make a button to switch?