Simple find in big lists (Shortcuts/commands, Toolbar etc.)

Ideas for improvements and requests for new features in XnView MP

Moderators: XnTriq, xnview

Post Reply
User avatar
m.Th.
XnThusiast
Posts: 1546
Joined: Wed Aug 16, 2006 6:31 am
Contact:

Simple find in big lists (Shortcuts/commands, Toolbar etc.)

Post by m.Th. » Fri Jan 24, 2014 10:16 am

The program has and will have more big lists of items (ok, some of them are trees). Some examples: The big list from Settings | Shortcuts (how do I find a certain command to assign a shortcut?), the big list from Settings | Toolbar (how do I find a certain button?), Auto Correct (in the future), Bookmarks manager (in the future) aso. Having the lists sorted really isn't enough.

Of course, we can implement for all of them the Auto Complete engine but I think that it could be rather complicated. If Pierre thinks that it is simple to do it, then it will be the best thing.

But if it is not, then we can live with a simple search view like this one:
Auto-Correct Tooling.png
Auto-Correct Tooling.png (15.04 KiB) Viewed 346 times
...which will do a simple case INsensitive(!!!) search on the grids, line by line till it will found something.

The untested, unoptimized pseudo-code will be something like:

Code: Select all

function DoSearch(aFromRow: integer; myText: string; myGrid: TGrid): boolean;
begin
	Result:=False;
	for y:=aFromRow to myGrid.RowCount-1 do
	begin
		for x:=0 to myGrid.ColCount-1 do
			if Pos(UpperCase(myText), UpperCase(myGrid.Cells[x,y]))>0 then //found!!
			begin
				Result:=True;
				Break; //out from cycle!
			end;
		if Result then
		begin
			myGrid.Cells[x,y].Selected:=True;
			Break; //out from y cycle also!
		end;
	end;
	if not Result then
		ShowMessage('Text not found!');
end;
Of course, for Find First the call will be with aFromRow = 0 and for FindNext will be with CurrentRow+1.

This could be very easy a shared code and view among many lists in our program: list of Toolbar buttons, list of the Shortcuts, Auto-Correct list aso.
m. Th.

The Ascetic Experience - The best photos and texts from Holy Mountain (Athos)

- Dark Themed XnViewMP 0.90 64bit & XnView 2.00 x64 on Win7 x64 -

Post Reply