QuickFilter Button

Preferences / File Displays / FAYT and Filter Bar Options / Partial matching must be turned on.

Ctrl + Click: star with

Shift + Click: end with

Click: contain

Download:

Quick Filter.dcf (3.2 KB)

Script code for reference (same as in the .dcf file above):

Option Explicit
Function OnClick(ByRef clickData)
	DOpus.ClearOutput
	Dim cmd, lister, tab, dlg, ret, S_With, E_With, S_Text
	S_With = "" : E_With = "" : S_Text = "Contain"
	' ---------------------------------------------------------
	Set cmd = clickData.func.command
	Set dlg = DOpus.Dlg 
	' Initialise the object to display a popup menu the user can select from
	'DOpus.Output ClickData.Func.Qualifiers
	Select Case LCase(ClickData.Func.Qualifiers)
		Case "ctrl"  : E_With = "*" : S_Text = "Star With"
		Case "shift" : S_With = "*" : S_Text = "End With"
	End Select
	dlg.window = DOpus.Listers(0)
	dlg.choices = Array(S_Text, "-", "Clear	&-", "-", "Number	&0", "-", "A	&A", "B	&B", "C	&C", "D	&D", "E	&E", "F	&F", "G	&G", "H	&H", "I	&I", "J	&J", "K	&K", "L	&L", "M	&M", "N	&N", "O	&O", "P	&P", "Q	&Q", "R	&R", "S	&S", "T	&T", "U	&U", "V	&V", "W	&W", "X	&X", "Y	&Y", "Z	&Z", "-", "Symbol	&=")
	dlg.menu = Array(8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
	' Show the menu and print the results to the script log
	ret = dlg.Show
	DOpus.Output "Ret = " & ret & " Key = " & ChrW(ret + 90)
	Select Case ret
		Case 3 : cmd.RunCommand("Set QUICKFILTERCLEAR")
		Case 5 : cmd.RunCommand("Set QuickFilter " & S_With & "(0|1|2|3|4|5|6|7|8|9)" & E_With)
		Case 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 : cmd.runcommand("Set QuickFilter " & S_With & Chr(ret + 90) & E_With)
		Case 34 : cmd.RunCommand("Set QuickFilter " & S_With & "('~|`|!|@|'#|$|^|+|-|_|;|'(|')|{|}|[|])" & E_With)
	End Select
End Function

2023-09-29 fix I press A, c appears

3 Likes

Oi @qiuqiu thanks for the code, but I wanted to ask you a few things.

  1. Why is it that if I press a key, the character of another appears, for example, if I press A, c appears?

  2. What is the difference between pressing the left and right keys?

  3. Is it possible to keep the panel always visible?

Thank you so much!

issues1
modify script 24 line to:

		Case 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 : cmd.runcommand("Set QuickFilter " & S_With & Chr(ret + 90) & E_With)

modify script 25 line to:

		Case 34 : cmd.RunCommand("Set QUICKFILTER " & S_With & "('~|`|!|@|'#|$|^|+|-|_|;|'(|')|{|}|[|])" & E_With)

issues2 no difference
issues3 You can create a toolbar yourself and add related buttons

1 Like

Thank you very much for the help, now the characters are matching perfectly, but now I want to ask you for another help, I incorporated the letter "Ñ" (spanish) to the menu, between the "N" and the " O", occupying position 22 in the array of the line dlg.choices =... In the line Case 7, 8, 9..., I added the value 34 to make it match the array that gained one more element, but when I press the "Ñ", the "O" appears and so on with the other letters from that position, that is, the letter "Ñ " exists in the menu but not in the selection.

And I didn't understand about trying to keep the panel always visible.

Thank you so much

  1. i tried to use this script a few times, but every time i got only 'contain' match. no start with Ctrl and no end with Shift. Why?

  2. and every other time I see such a problem - to select the right letter, you need to hover the mouse over one line below!!! i stay on "D" in my picture (visually on "E")

I also experienced that behavior with the Ctrl and Shift keys.

By the way, if in Preferences > File Displays > FAYT and Filter Bar Keys, in Default Mode you select Filter Bar, you can start filtering by pressing any key (like the ones on this button) that is not previously configured as a FAYT/Filter Bar key, (you can even use Regular Expressions!), which makes this button pointless.
Anyway, I have made some changes to make your button work more properly. Hope that helps you.
Filter Bar With.dcf (4.3 KB)

Thank you very much @errante , the button is now better, although it doesn't really have much functionality, we got the same result by typing directly with the keyboard, it would really be useful if it stayed fixed on the screen and we could use it as a virtual keyboard, anyway thank you very much to @qiuqiu for the effort!

Here is another version as a toolbar.

It uses commands not scripts. LMB on a letter to get all items that begin with the chosen letter or RMB for all items that have the chosen letter anywhere in the item name. Another LMB or RMB clear the filter.

Revised version with numbers and symbols.

I use it as a vertical toolbar where it takes little screen space.

-Any or First Letter 3B Alpha Find.dop (44.3 KB)

1 Like

Thank you @jinsight , great contribution, this one is much better, it is always fixed, don't you plan to incorporate the numbers and some special characters?

But a toolbar takes up much more space than the filter bar... I thought your original complaint about not using the filter bar was because it took up screen space. Pressing the actual keys that you want to filter is always more comfortable and faster than pressing a button IMO

@errante My problem with the Filter bar is not itself the space it takes up, but that I don't need all of its resources, for me the Filter field is perfect, just that I was asking to see if it could be updated with the checkboxes and file count same as Filter bar.

This bar proposed by @jinsight is very good for me because I can customize it and optimize its space. And it is true that it is faster to press a key on the physical keyboard than on a virtual one, but in my case it is not about speed but rather I work a lot at dawn with the lights off so as not to bother others, and I don't see well the physical keyboard, and with the virtual keyboard that problem is solved.

FWIW, you can just use On Screen Keyboard. Just type osk in Start Menu and run it from there

1 Like

Wow!, I didn't know about that trick, wonderful thing, thank you very much @errante, and do you know how to make it work from a button on the toolbar?

Create a button writing "osk" alone as a command. That's it. You can choose whatever icon you like or set a hotkey for run the command

I already did it, perfect, I didn't know it would be so simple, the previous time I had executed it from the Windows Command Line, thanks a thousand times @errante :clap:

Revised version as suggested is in original post.

In the original version, some keys do not match the character that is printed on the screen, and there are also two columns of characters that print exactly the same