How to set favorite folder format for lister style or tab group?

How can I set a (favorite) folder format for a lister style or tab group?

I have some lister styles and each lister style has a corresponding tab group. When I select the lister style (and all tabs of the defined tab group open), all tabs should have the defined (favorite) folder format.

I don't want to specify the same format for each tab in a tab group.

Thanks

Is the aim for the style to apply a custom folder format to all the tabs? (Different to the one you want when not using the style.)

Leo,

this is my start ... my default style + default tab group and my default user format:

Then I select the style "My Photo Style 1":

TG_1b

Previously I'd a tab group "My Photo Tab Group" but then I can not select a folder format for all tabs in the tab group.

Now I have removed the tab group and can edit the format for the style - I choose "Format / Edit / Columns / Reset Page => Set From Favorites => My Photo Format.

I select the style with this code

Prefs STYLE "My Photo Style 1"
Go TABGROUPLOAD "My Photo Tab Group" OPENINLEFT
Go TABGROUPLOAD "My Photo Tab Group" OPENINRIGHT
Set SOURCE=left

Now I have this

I see the actual tabs with the new format of the style (ok), but when I select another tab (e.g. the 3rd tab of the right display):

then I still see the standard default format.

So how can I set the folder format to all tabs?

Do you also see the bug in the latest picture? The breadcrumbs of the selected other tab are not washed anymore.

And when I do not select the 3rd tab on the right above and switch back to my default style (with default tab group) I get this:

which shows the tab on the left with the default format - but the same tab (same tabgroup opens on left+right) on the right shows the photo format instead of default format (bug).

Additionally the 3rd bug: :wink:

After selecting the style (+ open tab groups), when I select on the left display the tab groups, DO correctly shows the selected "My Photo Tab Group", but the right display still shows the "My Default Tab Group".

Tested with DO 12.9.0

Maybe this will help. Click this button and it will assign the My Photo Format format to all tabs on both sides of the current window.

If that's the only aim of the style, then you're good to go and can use the button instead of the style. Otherwise, if you want the style to also open the folder tabs, you can re-save the style after clicking the button to update the format in all tabs.

Test JScript.dcf (1.1 KB)

function OnClick(clickData)
{
	var formatName = "My Photo Format";

	var cmd = clickData.func.command;
	cmd.ClearFiles();
	cmd.deselect = false; // Prevent automatic deselection

	for(var eTabs = new Enumerator(clickData.func.sourcetab.lister.tabs);
	    !eTabs.atEnd(); eTabs.moveNext())
	{
		cmd.SetSourceTab(eTabs.item());
		cmd.RunCommand('Set FORMAT="' + formatName + '"');
	}
}

Thanks a lot Leo.

Is it possible to "link" the format of a tab to a favorite format?

So when I change/update the favorite format - all tabs (who are linked to this favorite format) automatically use this updated format.

Currently I can only "copy" a tab format within "Edit tab group" by selecting each tab, click "edit format", walk through each part and select "reset page / set from favorites". So when I change the favorite format I can do all steps again, right?

Sorry for the question - but at the moment I'm more confused before I started. :wink:

You might be able to do something with an event-driven script that applies the format after the style is loaded, but there's nothing like that built in.

Is the purpose of the style just to change the format, or to load a tab group, or both?

Is the format one that you don't always want for those folders, only sometimes?

both

only sometimes - with this or other styles

I've tried to add an event-driven script but when I select the style the for-loop only rotates over one tab of each display (left/right) and not over all tabs per display opened by the style via the tabgroup (finally 8 tabs are open left and 8 right).

function OnStyleSelected(styleSelectedData)
{
  if (styleSelectedData.style == "My Photo Sortin 1")
  {
    var formatName = "My Photo DateTaken";

    var cmd = DOpus.Create.Command;
    cmd.ClearFiles();
    cmd.deselect = false;

    for(var eTabs = new Enumerator(styleSelectedData.lister.tabs);
        !eTabs.atEnd(); eTabs.moveNext())
    {
      DOpus.Output("Tab: " + eTabs.item().displayed_label);
      //cmd.SetSourceTab(eTabs.item());
      //cmd.RunCommand('Set FORMAT="' + formatName + '"');
    }
  }
}

Output is

 2018-08-26 18:15 PhotoSortin1:  Tab: Photos & Videos
 2018-08-26 18:15 PhotoSortin1:  Tab: Photos & Videos

= the first tab from left and right.

When I change "styleSelectedData.lister.tabs" to "styleSelectedData.lister.tabsleft" only one line is printed.

What I'm doing wrong?
Is it possible that the event is executed before all tabs of the tabgroup of the style are opened?

Maybe we can make it like OnOpenLister where scripts can be called both before and after all the tabs are loaded.

At the moment, you could set a variable on the lister which tells you it has loaded that style (and clear it if another style is loaded), then use OnOpenTab and/or OnAfterFolderChange to apply the formats to tabs/folders as they open, if they're in a lister with the variable set.

That would let you cover new tabs opened after loading the style as well, if you want that. (If you don't want that, setting another lister variable to a timestamp of the event would let you ignore events that happen more than a few seconds later.)

OK ... it becomes more complex and today is the 4th day of my holiday I play around with that. Not that what I want to do during my holiday. :wink:

What drives me nuts ... to understand the formating of folders:

I have my "user format" only (beside a favorite format).
I'd the columns "modified" and "created" (in this order).
I created some styles with tab groups (some tabs and all formats (all parts of each tabs) are disabled) - like this:

so I expect the "user format" will be used, or not?

Now I have changed my "user format" and swapped the columns to "created" and "modified".

I select the style (or any other), but still get order "modifed" + "created" :disappointed_relieved:

Then I did the test:

I selected on tab of the tab group of a style, activated "Columns and Grouping", changed the columns to order "created" + "modified", unselected(!) "Columns and Grouping" and "OK":

SO2

Then I re-selected the style and all tabs still show "Modifed" + "Created" but the one tab I just changed shows "Created" + "Modified" - although all parts of the format are disabled.

So how the hell does it work (which I must ask after using DO for more then 12 years)?

If you want the default/user format to be used you should not normally need a style for that. That should be the format the folders get by default, unless some other format is overriding things for the particular folders.

Set the style and tab group to leave the format untouched entirely if you want the folders to get their natural formats, the same as if you opened a new window and navigated to them.

At any time, hover over the format lock on the status bar to find out which format is being used and where it came from. That and lots of other details about how to understand how the format is chosen can be found here (although using Styles on top of things can complicate things further than the guide goes into):

Folder Formats can be complex because they let you do a lot of different things. Without the complexity, the answer would be like in File Explorer: "you can only show each folder one way".

It's a holiday here as well. :slight_smile:

Hi Leo,

I've read all the chapters multiple times over the years including now. :wink:

Why is the folder format of the tab from the tab group used although "Columns and Grouping" (and all other parts) are not selected?

See the screen shots:

Here are my folder formats:

Here is my user format which I've used for years ("Modifed" before "Created").

F2

Here is the options part:

F10

I've created multiple styles like e.g. this. No format, etc. is selected so it shouldn't be used - only tab groups:

F3

The tab group "My Video" has the following tabs and all tabs are using this following folder format:

"Columns and Grouping" is not selected - so it shouldn't be used, right?

.. and the options part:

F11

I then select the style and this will be shown ("Modified" then "Created"):

On the "Lock Status" you can see that the format is based on the tab #1 of the tab group.

How can this be possible when it is not selected (see screen shot above)?

Now I change the user default format - I swapped the columns "Created" and "Modified" (into this order):

I select another style and re-select this "My Video" style. "Modified" and "Created" columns are not swapped.

The updated user default style isn't used which I would await.

I have also tried the "My Video" style and the other style for the test case also with a Not-Selected Format Lock (=unlocked). Finally no difference. Format will be always based on Tab of Tab Group although not selected.

Why is the folder format of the tab from the tab group used although "Columns and Grouping" (and all other parts) are not selected?

Thanks a lot,
Robert

I'll need some time to look through this and work out what's going on (both in the thread and in the code).

We're also thinking about making it so Tab Groups, Styles and (possibly) Layouts can refer to Favorite formats indirectly, so you can set them up once and then only need to change one thing. (That won't make it into 12.10 as we've locked down UI changes for translations to begin, but it might be in a later version, depending on how difficult it turns out to be.)

If you only take a look on my last post of this thread and try to re-create the problem that's enough (should be a new thread more or less).

Yes - defining some favorite formats (on one place) and linking to it instead of having extra possibilities of formats would be much easier to manage for beginners and experts. :sunglasses:

In the meantime I can live with Modified/Created order (I'll wait for new DO release) and with the first script as a button. I only sortin pictures 1-2 times per year. :grinning:

In case of you need to take a look on my PC - Teamviewer is installed.

Thanks a lot!