Author Topic: Toggle filter function  (Read 9263 times)

matm

  • Active Member
  • ***
  • Posts: 42
    • View Profile
Toggle filter function
« on: November 20, 2011, 21:15:19 »
Hello

I would like to have a button that toggle display filter on/off. for this to work, I need to know the state of my filter.
Is there some MC.Explorer.GetViewFilter  that can retrieve the current filter, or a way to test if a certain kind of file is displayed ?

I would expect doing something like that :

Code: [Select]
@var $filter = "-*.log"

if ( StrIsEqual({MC.Explorer.GetViewFilter}, $filter))
{
     MC.Explorer.SetViewFilter FILTER={$filter}
}
else
{
    MC.Explorer.SetViewFilter FILTER="*.*"
}

Is there already some stuff to do that ?

Regards

Mathias (yes, you read well)
« Last Edit: November 20, 2011, 21:17:53 by matm »

matm

  • Active Member
  • ***
  • Posts: 42
    • View Profile
Re: Toggle function
« Reply #1 on: November 20, 2011, 21:17:16 »
Also, the http://multicommander.com/docs/customcommands_list is empty. Is this expected ?

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3602
    • View Profile
    • Multi Commander
Re: Toggle filter function
« Reply #2 on: November 20, 2011, 22:33:28 »
No there is no "MC.Explorer.GetViewFilter" But sounds like a good idea to add.

I will add that to the next release.


(edit)
After thinking about it, It might not be so easy to fix. This "Custom commands" can not return sometime to the script engine.  Yet.
But I will see if i can figure out a solution for it.
« Last Edit: November 20, 2011, 22:50:49 by Mathias (Author) »

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3602
    • View Profile
    • Multi Commander
Re: Toggle filter function
« Reply #3 on: November 22, 2011, 20:11:56 »
In the latest Beta RC (874)

this can work now.

Code: [Select]
@var $filter = "-*.log"
@var $currentFilter;
MC.Explorer.GetViewFilter
$currentFilter = $__CMDRESULT;

if(StrIsEqual($currentFilter, $filter))
{
  MC.Explorer.SetViewFilter FILTER="*.*"
}
else
{
  MC.Explorer.SetViewFilter FILTER={$filter}
}

matm

  • Active Member
  • ***
  • Posts: 42
    • View Profile
Re: Toggle filter function
« Reply #4 on: November 25, 2011, 00:12:39 »
Nice. That's great !

TY

When do you plan the next stable (even a range) ? :)

Mathias (Author)

  • Administrator
  • Elite Member
  • *****
  • Posts: 3602
    • View Profile
    • Multi Commander
Re: Toggle filter function
« Reply #5 on: November 26, 2011, 10:53:30 »
Va none beta version of 1.2.1 is planed for this weekend. (today or tomorrow)