Rixstep
 About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Home » Learning Curve » ACP Guru

Xfile Keeps Your Selections

It's not easy, anyone could do it, no one else dares even try.


Get It

Try It

A major recurring difficulty with generic information managers, such as file managers, is ease of use. Perhaps some people remember when Microsoft first introduced their Explorer (NOT Internet Explorer) to replace the workhorse File Manager (WINFILE.EXE). One ran into problems with sorting and with selections.

If you renamed something in a list, such as in one of the C:\WINDOWS directories, things got quirky. Suddenly your sort was all off, for starters.

This was a huge issue for Microsoft, but it shouldn't have been. Microsoft opted for a strange solution, somewhat like what they did with their EDIT control when switching from wrap to non-wrap or the other way around.

Silently and behind the scenes, Microsoft created a wholly new 'right pane' for your file listing, now sorted the way you wanted, and put it on screen behind the one currently displayed, then it obliterated the one you saw, leaving only the new one. This was done on user input for a 'refresh'.

Microsoft controls go a bit further than NeXTSTEP controls. NeXT, adhering completely to the Model-View-Controller (MVC) paradigm, do not go that far. Microsoft 'list views', corresponding to NeXT's 'table views', are OK with retaining state information, where NeXT's are not. Microsoft's list views can, in addition, retain data about which rows in a list view are in focus. NeXT's API has no such concept, and things run into trouble after a while, where the nomenclature becomes confusing. The API to get an array of 'selected rows' is OK per se, but the API to get *the* selected row actually returns the index of the *last* selected row, which may be assumed to be the row actually in focus, even though there is no visual feedback in the matter.

All of which is highly confusing, and even more so when reading an abstract description in a text such as this.

Put this another way then. It is possible, with Microsoft's API for their list view, to have a row that is not selected but still in focus. This is shown on screen by a faint dashed line. If the row is also selected, then of course there is a 'colour fill' for the row as well.

NeXT has no corresponding functionality.

The NeXT API for table views, the counterpart to Microsoft's list views, adheres strictly - strictly 0 to the MVC paradigm. Table views need a data source. The program provides this data source. The table view model (that which you see on screen) retains nothing.

Let's try with a bare bones example. Let's assume the user is non-trivial and working on non-trivial datasets.

(We ran into this issue right before the new millennium when Reuters had a backlog of millions of email messages on their servers in London (running, to make matters worse, on slow Ethernet connections) and they needed fast file management tools, which we of course provided.)

Let's assume the file listing in question is at least 2000 rows long, par for the course for an old Windows system directory. Let's assume it's a listing for Windows, meaning there are only a handful of possible sorting algorithms.

Let's assume further that you, the user, are currently sorting to file name (ascending).

Let's assume that the first name in your listing is 'AARDVARK.jpg'.

Suddenly you realise that 'AARDVARK.jpg' is actually a photo of a zebra! Oy vey! So you want to rename your file to 'ZEBRA.jpg', don't you?

Good luck on Windows (at least back in the day). You open an edit session right on the file name, replace 'AARDVARK' with 'ZEBRA', and it's done. But the file is still listed at the top, and not in alphabetical order!

To get that alphabetical order, you had to issue a 'refresh' command. Whereupon Microsoft, unseen by you, would create a new list view, still unseen, put it in place behind your visible (and incorrect) list view, sort it correctly, take away the incorrect list view, revealing the correct new one, and so forth.

Some of these things work with the NeXT API, but not all, and not well. So let's take an example from the world of OS X, with Xfile demonstrating things.

Let's take this abstractly and cut back on eye candy. For no matter what data you change anywhere in an Xfile listing, no matter how long that listing, that listing is automatically sorted correctly after the change.

But there's more. Getting back to the 'selection' thing again. For X-file will always ensure that your selection(s) remain in view after the change.

This holds no matter the sort column or the size of the list.

No one else anywhere in the world of OS X even dares try it.

So how is this done? This makes a world of difference when working in non-trivial environments. So it's good to have.

The modus operandi is painful but obvious.

  1. Create a stack array. Populate this array with the data for the currently selected rows.
  2. Save the data for the currently 'focused' row.
  3. Repopulate the visible array according to the new sort algorithm.
  4. Select the rows from above with the 'focused' row being added last (to make it 'focused') and then make sure this row is visible.

The corresponding 'courtesy' is performed as well on Xfile's left pane 'tree view' on refreshes, to make sure the selected directory is not at the very bottom.

Although NeXT's MVC doesn't want its view to retain data, and although the concept of the 'focused row' is ambiguous in that API, the desired end result can still be achieved, albeit with a bit of hard work.

And yes, Xfile's renderings are still lightning-fast, despite this feature having been incorporated right from the get-go, so many many years ago. Never accept cheap substitutes.

Stay safe and virus-free.

About Rixstep

Stockholm/London-based Rixstep are a constellation of programmers and support staff from Radsoft Laboratories who tired of Windows vulnerabilities, Linux driver issues, and cursing x86 hardware all day long. Rixstep have many years of experience behind their efforts, with teaching and consulting credentials from the likes of British Aerospace, General Electric, Lockheed Martin, Lloyds TSB, SAAB Defence Systems, British Broadcasting Corporation, Barclays Bank, IBM, Microsoft, and Sony/Ericsson.

Rixstep and Radsoft products are or have been in use by Sweden's Royal Mail, Sony/Ericsson, the US Department of Defense, the offices of the US Supreme Court, the Government of Western Australia, the German Federal Police, Verizon Wireless, Los Alamos National Laboratory, Microsoft Corporation, the New York Times, Apple Inc, Oxford University, and hundreds of research institutes around the globe. See here.

All Content and Software Copyright © Rixstep. All Rights Reserved.

CONTACT INFO:
John Cattelin
Media Contact
contact@rixstep.com
PURCHASE INFO:
ACP/Xfile licences
User/Family/Business
http://rixstep.com/buy
About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Copyright © Rixstep. All rights reserved.