Toolbar - config ONLY for Dual List

Hi - I would like to have a vertical toolbar between two vertical panes in Dual Lister view, and then have the toolbar disappear in single Lister mode. Can someone help me out and point me in the right direction?

you can create 2 styles to do this, say 'Single' & ' Dual'. When a style is created it will be added to the styles menu. Arrange the elements/panes/listers how you want then right-click the style to bring up a menu and click update.

see the documentation about styles :
https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Styles.htm

you can create a new style from here :

Much easier to just create a button which toggles Dual and the toolbar:

Set DUAL=Vert,Toggle 
Toolbar NAME=YourToolbarName STATE=center TOGGLE 

Replace YourToolbarName with the name of the toolbar you want to use.

1 Like

Thank you very much Steve! This is awesome!

1 Like

You could also do this with a script, using the OnListerUIChange event, so the toolbar automatically opens or closes no matter which way you open or close the dual pane.

1 Like

Hi Leo - thanks. I found this piece of code in the examples:

' The OnDisplayModeChange event is called whenever the view mode is changed

Function OnDisplayModeChange(ByRef displayModeChangeData) 

' The DisplayModeChangeData object gives us the Tab that the mode was changed in

    ' See if the folder currently displayed in the tab is lib://Pictures or a sub-folder

    If Left(displayModeChangeData.tab.path, 14) = "lib://Pictures" Then

        Call CheckPictureSorting(displayModeChangeData.tab)

    End If

 

End Function

From what I can tell if I figure out how to change the logic with the following pseudo-code:

If (dual pane) then set toolbar named "mytoolbar" to center
   Else set toolbar named "mytoolbar" to off

Here you go. This script will toggle a centre toolbar on whenever you change a lister to dual mode, and turns it off when you change to either single or dual horizontal.

Centre Toolbar.js.txt (813 Bytes)

Edit the script and change the line var CENTRE_TOOLBAR = "Steve.Script"; to use the name of your toolbar. Then copy the script to Preferences / Toolbars / Scripts.

Script:

// Centre Toolbar

var CENTRE_TOOLBAR = "Steve.Script";

function OnInit(initData) {
    initData.name = "Centre Toolbar";
    initData.version = "0.1";
    initData.copyright = "(c) 2020 Steve Banham";
    initData.desc = "Display a central toolbar when Lister changes to dual mode.";
    initData.default_enable = true;
    initData.min_version = "12.20";
}

function OnListerUIChange(ListerUIChangeData) {

    var factory = DOpus.Create();
    var cmd = factory.Command;

    if (ListerUIChangeData.change == "dual") {
        if (ListerUIChangeData.lister.dual == 1) {
            cmd.RunCommand("Toolbar NAME=\"" + CENTRE_TOOLBAR + "\"" + " STATE=center");
        }
        else {
            cmd.RunCommand("Toolbar NAME=\"" + CENTRE_TOOLBAR + "\"" + " CLOSE");
        }
    }
}
3 Likes

Thanks Steve - works perfectly and gives me something to tinker with!

1 Like