Page 1 of 1

Relating the folder pane to the file pane

Posted: 30 Dec 2016 11:24
by sclg
I'm sure I'm missing something obvious here...
Is it possible to lock the folder tree display on the left to the tab that is open?
Say I have five tabs, when I change to a different tab, it would be good if the file tree went to the state it was in when I was last on that tab.
As it is, it always stays the same in terms of which folders are expanded and which aren't.
Any ideas?

Re: Relating the folder pane to the file pane

Posted: 31 Dec 2016 11:29
by highend
XY doesn't provide that feature, so maybe a script?

Ofc this requires the user to switch tabs through the script^^

This could get you started:

Code: Select all

    $ini     = "<xydata>\trees.ini";
    $tabs    = get("tabs");
    $abbrev  = "1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
    $tabList = "";
    while ($i++ < gettoken($tabs, "count", "|")) {
        $tabList = $tabList . gettoken($abbrev, $i, ",") . " - " . gettoken($tabs, $i, "|") . "|";
    }
    $tabIndex = regexreplace(popupmenu($tabList, , , , , 1), "^([a-z0-9] - )(.*)", "$2");
    $tabPath  = tab("get", "path", $tabIndex);
    if !(exists($ini)) { writefile($ini, , , "tu"); }
    setkey get("tree"), "tree", tab("get", "path"), $ini;
    seltab $tabIndex;
    $iniPaths = getsectionlist(, $ini);
    foreach($iniPath, $iniPaths, <crlf>) {
        if ($iniPath == $tabPath) {
            loadtree getkey("tree", $iniPath, $ini);
            break;
        }
    }


Re: Relating the folder pane to the file pane

Posted: 31 Dec 2016 11:37
by sclg
Thanks for the idea - obviously time to get to grip with scripts!