Why does Explorer show a + sign even if there are no child folders?


Mike Williams asked in the Suggestion Box why Explorer shows a + sign next to a folder even though it doesn't have any children. Mind you, this wasn't a suggestion; it was just a random question. I don't enjoy answering random questions about specific details of user interface elements since, as it turns out, I did not write every single user interface element in the system, nor did I attend all of the design meetings.

Some people are under the impression that as a senior developer that works with the user interface, I naturally attend every single user interface design meeting, even meetings to discuss things that I am not responsible for. I don't know when these people expect me to get my work done or why I would enjoy going to hundreds of meetings that have nothing to do with my job. These people probably expect a senior electrical engineer at Boeing to attend all meetings on each of the 777's electrical systems, even if her responsibility is just the entertainment system.

Another reason I don't enjoy answering these questions is that the person who asks the question is unlikely to be interested in the answer, since the answer is usually boring and technical.

Anyway, I don't know the answer, but I'm going to guess. (Actually, that sentence applies to most of what I write. I just guess with confidence.)

Recall that Explorer is a view onto the shell namespace, and that each item in the shell namespace has attributes. The attribute that is important here is SFGAO_HASSUBFOLDER, which indicates that the item is a folder that might have sub-folders. This is a strange backwards-like flag, since it is the absence of the flag that provides definite information. If SFGAO_HASSUBFOLDER is not set, then the shell namespace extension is promising that the folder has no sub-folders. If the flag is set, then the folder might have sub-folders, or it might not; no promises. Explorer uses this flag to determine whether to show a plus-sign next to an item in the Explorer folder view. If the flag is set, then a plus sign appears.

Yes, this means that the plus sign appears even if there are no sub-folders, but it's better than showing no plus sign when there are sub-folders. When you click the plus sign, Explorer goes looking for sub-folders, and if it ultimately finds none, then the plus sign disappears.

Why not require that the flag be definite? In other words, why not say that SFGAO_HASSUBFOLDER guarantees the presence of a sub-folder, rather than merely hinting at the possibility of a sub-folder?

Performance.

Determining whether a folder has a sub-folder can be very expensive. For example, if the folder is a directory on a server halfway around the world, hunting for a sub-folder requires enumerating the contents of the directory looking for anything that's a sub-directory. (Yes, you could try using the FindExSearchLimitToDirectories information level, but there is no guarantee that the server halfway around the world supports it.) This is quite an expensive undertaking just to decide whether to show a plus sign, and corporate administrators might not look too fondly on the "unnecessary" network traffic generated by all this probing.

What's more, determining whether there is a sub-folder may require additional user interaction. For example, the folder might be on a password-protected FTP server. It would not be a very good design to prompt the user to log in to an FTP server just so Explorer could decide whether or not to show a plus sign next to the server's icon in the folder tree.

I believe that Windows Vista sheds a much more skeptical eye on the SFGAO_HASSUBFOLDER flag. In part because some shell namespace extensions mis-manage the flag (forgetting to set it when they should) and because some users get upset by the "plus sign that doesn't do anything", Explorer's kicks off a background thread to verify the plus-sign status of each item in the folder tree, or at least verify what it can without causing network administrators grief or disturbing the user. (Users wouldn't like it if you, say, spun up the CD-ROM drive just to check whether or not to show that plus sign.) If you watch carefully, you might see a tiny magnifying glass overlay placed atop the folder icon while this background verification takes place.

The remaining questions in that same comment are even less interesting. Clicking the plus sign will make it go away once Explorer has confirmed that there are no sub-folders after all. Perhaps the namespace extension is slow to enumerate sub-folders? And as for the cancellation of renaming: I don't see this behavior. When a file copy completes in the background, I can still rename whatever I was renaming.

Comments (32)
  1. Vladimir says:

    <i>I don’t enjoy answering random questions about specific details of user interface elements</i>

    Reading your blog for so long, I don’t remember a single suggested topic you were happy to cover ;) Every time you answer a question you start it with "omfg oh noes these questions again, wtf guys why do you do that?"

    Just don’t answer them if you don’t like it. Answer the ones you’d like to cover. I’m pretty sure nobody wants to force the answer out of you anyways.

    It’s just that the suggester might have thought that since this topic is definitely "<i>Windows user interface programming in Win32, and shell programming in particular</i>", which is what you’re "<i>more inclined to cover</i>", suggesting it may be a good idea.

  2. Randall says:

    Nobody’s forcing you to post about anything; if a suggestion is painful to write about, isn’t in your specialty, has too obvious and answer, and isn’t phrased correctly to boot, you can skip it and write on stuff you enjoy.

    I love your blog.  I don’t think you need to let negative or non-advanced commenters (including me) bother you so much — there’s no battle to have.  If someone’s dead wrong, you can ignore them and go write a fun post.

    (I have to admit sometimes the dynamic adds to the blog — when you think you’re overexplaining, sometimes the clarifications are useful and the exceptions interesting. Also, the pre-emptive snarky comments have been just golden. ;) )

    Of course, my "you don’t have to listen to anyone" position applies to this very comment, too.

  3. CJ says:

    I think what irks the user is that even after "additional user interaction" is done, which is selecting the folder (with the plus sign in question) in the folder tree on the left, the explorer leaves the plus sign as it is when the right side view shows that there are no sub-folders.

  4. ak says:

    I have seen the cancellation of renaming several times, start out with a folder with 50 or so files at around 1gb in total, move all those files except one to another folder, rename this last file, if you are unlucky, it will cancel the rename at the end of the copy op. (XP SP2)

  5. Gabe says:

    I think that canceling the rename is really just a function of losing focus. If a copy operation finishes and lets you know by changing focus, the rename will lose focus and cancel the operation.

  6. mikeb says:

    Post-Psychic Nitpicker’s Corner:

    To Mike Williams:  the Suggestion Box is not Jeopardy!, Please do not phrase your suggestions in the form of a question.  I suggest this alternate:

    ====  Old New Thing Suggestion Box Entry =====

    Dear Mr. Chen:

    I would like to suggest that you answer these 2 questions about niggling little annoyances in Windows Explorer, if you happen to know the answer and that answer is sufficiently interesting for you and your blog.  Please forgive my presumption if these questions are far too idiotic for your consideration.  Oh, and please do not consider the fact that I entered this suggestion to place you under any obligation to even think about it (much less reply) – your attention to this matter is entirely optional:

    1. Why does Explorer often show a + tree expander button next to folders that don’t have any subfolders? And why doesn’t clicking it make it go away?
    2. If I’m renaming a file in Explorer, why does it lose focus (and any mid-edit changes) if Explorer finishes another task? Isn’t the UI multi-threaded?

    ======================================

    There.  Now isn’t that a much better suggestion?

  7. JW says:

    Just don’t answer them if you don’t like it. Answer the ones you’d like to cover.

    And do you really have to call out the poor guy by name at the top of your post, just for asking a harmless little question?

  8. Reginald Wellington III says:

    A question in the suggestion box is implying a suggestion that you cover the topics related to the question.

    Do we need to include a nitpicker’s corner or disclaimer with every suggestion now? "Nitpicker’s Corner:  Although phrased as a question, it is really a suggestion to cover the topics included."

    Should we include a pre-emptive snarky comment section?  "Pre-emptive snarky comment:  This isn’t really a suggestion, it’s a question you jerk!"

    Do we have to change our writing style to spell out explicitly that it’s a suggestion?  "I was going to write ‘How is it that Windows does XYZ’ but because of a particularly snarky blog maintainer I edited myself and changed it to ‘I suggest that you cover the background why Windows does XYZ’.  I hate that I have to censor myself and change my writing style."

    I can’t believe I had to write this.

  9. Xepol says:

    The article is a great prelude to lament a feature missing from Windows since Win95 first made it possible.

    FTP sites as folders right in the explorer.

    Actually, FTP sites as native OS objects even.

    Of course, none of this is part of Raymond’s job.  I just wanted to lament the lack of forsight to provide such a feature as a basic OS capability.  If it was part of Win95, people would never have questioned it.  Now if you introduced it, everyone would be screaming about monopoloy and anti-trust issues.

    [sigh]

    Is it any wonder Windows isn’t a better product today?  Every time they even think about trying, someone sues them.  I’m wouldn’t be surprised if they start getting pre-emptive lawsuits for ideas they haven’t thought up yet.

  10. Ulric says:

    yeah, that Renaming-being canceled question is just plain a silly whine.  And how does that relate to Windows being multi-threaded or not?  It doesn’t, keyboard focus is global.

    In any case, sure, it has happened. But XP and now Vista remove more and more cases when a dialog or something else can steal the focus. It might never happen on Vista, who knows.

  11. TwelveBaud says:

    I have seen the behavior, and it is related to the copy command setting focus to the newly copied material. Yes, it can be mildly annoying at times, but I get far more irritated at shell extensions that create objects and don’t focus on them than I get at shell extensions or the shell itself setting focus on them while I’m doing other things.

    Raymond, I appreciate all the effort you go to answering these questions, and if I were anywhere near the Microsoft campus I’d arrange for someone to personally thank you every day. Your answers are logical, insightful, and help me every time I go near Windows programming. If you don’t enjoy answering them, however, a nice blog post would be explaining who might be in a better position to answer those questions, for example Michael Kaplan of Sorting It All Out for internationalization issues or someone on the WinForms team for WinForms issues. Then we’ll ask them instead, leaving you free to blog on the topics of /your/ choice.

  12. Ulric says:

    The article is a great prelude to lament

    a feature missing from Windows since Win95

    first made it possible.

    >

    FTP sites as folders right in the explorer.

    I don’t get it.  I’ve been browsing ftp sites in Windows explorer (not internet explorer) in the past, and I’ve just done that right now in Vista and this other Windows 2000 machine.  What’s the problem?

  13. Matt says:

    "These people probably expect a senior electrical engineer at Boeing to attend all meetings on each of the 777’s electrical systems, even if her responsibility is just the entertainment system."

    Unfortunately for Boeing, "these people" are also the managers of said electrical engineer. (grumbling as I head off to yet another design meeting unrelated to the little piece I work on….)

  14. AK Wong says:

    Brilliant reply by Reginald Wellington III. Best comment ever! :-)

  15. Dean Harding says:

    "The article is a great prelude to lament a feature missing from Windows since Win95 first made it possible."

    Yeah, let’s use a post about the "+"es in explorer to complain about something *totally different* and *completely irrelevant*, but by putting a "the article is a great prelude" disclaimer at the start, it’ll be OK, right? Right?

  16. Merit says:

    I’d just like to point out that a lot of us enjoy these "boring and technical" answers, and it is in fact why some of these questions get asked in the first place.

  17. Xepol says:

    Ulrik -> I would love to hear how/if you accomplished that without 3rd party software.

    I’m not talking about paying for something that should be a true, native part of the shell experience.  

    If you know how, please, please share.

  18. Mike Woodhouse says:

    I usually scan the first couple of paragraphs of Win-ternal posts like these before moving on to something less, well, dull.

    Ironically, this time I read (and was interested by) the whole thing.

    So it goes.

  19. AK Wong says:

    Xepol, first of all, you need to ensure the "Enable FTP folder view (outside of Internet Explorer)" option is selected in Internet Options.

    Then, open a Windows Explorer window and in the address field, enter a URL of the form "ftp://username:password@hostname&quot;, or just "ftp://username@hostname&quot; if you want to be prompted for the password.

  20. Xavi says:

    Brilliant reply by Reginald Wellington III. Best comment ever! :-)

  21. Ben Bryant says:

    Just have to laugh at the way Raymond emphasizes “Performance” with its own paragraph when Internet Explorer is simply the dog of dogs. Then the only performance feature is one which takes away from the user experience? Wow.

    [Just had to laugh at the way people think that I am responsible for every product and feature that Microsoft produces, that an article that talks about Explorer behavior is declared ironic because of some characteristic of Internet Explorer. Wow. -Raymond]
  22. Wang-Lo says:

    Brilliant reply by Reginald Wellington III. Best comment ever, except for the one about using a sack of potatoes and a UPS van to inflate a bicycle tire.

    -Wang-Lo.

  23. Jon says:

    At first I was annoyed by the four paragraphs of childish whining at the top of this post.  But then I realized that it might actually be a comedic performance of the popular caricature of a Microsoft developer: a self-absorbed, egotistical, elitist entitlement persona.

    Surely a normal person doesn’t get all worked up just because someone asked him a question he might know the answer to.  Especially when he has a suggestion box right on his public website.  And even more especially when he regularly answers questions about a wide variety of topics on the Windows interface.  And especially especially when he in fact does have an idea what the answer is and subsequently posts that answer to his website.  That would just be ridiculous.

  24. jo says:

    I’d hate to be your boss if, as happens, you get asked to do something that isn’t your job – but do it anyway, instead of refusing – but then moan and complain about it afterwards.

    As interesting as your blog is, take a break if it’s getting too much.

  25. David Heffernan says:

    "Just had to laugh at the way people think that I am responsible for every product and feature that Microsoft produces, that an article that talks about Explorer behavior is declared ironic because of some characteristic of Internet Explorer."

    Most Windows users don’t know the difference between Explorer and Internet Explorer – hardly surprising since they have the same name and Explorer even morphs into IE  when you type an internet address in.

    I do think you should relax a little.  So what if people think you know everything about everything MS does?  You really should take that as a huge compliment.  If there were more MS devs writing the way you do then MS would have a much better image.

    Keep it coming!

  26. Ulric says:

    Xepol – with regards to FTP in explorer,

    As answered by AK Wong,

    just type in the ftp address in the path of Explorer? "ftp://ftp.microsoft.com/&quot;  

    It’s always been there.  It’s the best way to browse and copy file from and to ftp sites.

  27. Igor Levicki says:

    Thou shalt not steal focus from the user!

    As for that dreaded + it is stupid that when you click on the folder itself (not the +) it doesn’t go away even though Explorer clearly knows if there are subfolders or not by then, because it has already shown the content in the right pane.

    [The view pane knows, but the folder tree doesn’t. Two separate components. You can have one without the other. (For example, the Browse for Folder dialog uses the folder tree without any view pane.) -Raymond]
  28. Xepol says:

    Ulric -> Actually, that is thanks to IE shell integration, that IS using Internet Explorer (which is why the FTP site is nested under the IE icon), and hasn’t always been there.

    But enough nit picking, since it is like 90% of what I really wanted anyways and IE is now part of the shell.  I don’t think I knew it could do what it does, so great news, thanks!

    side note : I might have known this in the past, but I’ve probably long forgotten it – probably because it doesn’t let me permanently map ftp sites there like you can with network shares. [sigh] never a perfect world.

  29. J says:

    "probably because it doesn’t let me permanently map ftp sites there like you can with network shares. [sigh] never a perfect world."

    You can absolutely add an ftp site permanently just like a network share.  Anything else you want to complain about Windows not doing that it’s been able to do forever?  Double clicking?  Windows does that now I heard.

  30. Wizou says:

    [The view pane knows, but the folder tree doesn’t. Two separate components. You can have one without the other. (For example, the Browse for Folder dialog uses the folder tree without any view pane.) -Raymond]

    Yeah and … ? Does that prevent an intelligent design so that when they are both present, the view pane helps the tree pane ?

    It sure is not something you code at first, but after years of development in Explorer, it could have been implemented..

  31. Dmitry Kolosov says:

    Raymond, I don’t see how "Two separate components" argument applies here. Even if there’s no view pane, the tree can hide + when you hit +. Why can’t it hide + when you hit the item?

  32. Dmitry Kolosov says:

    Cool disclaimer "they are not the same". Maybe it was just on a Freudian slip that Ben Bryant wrote "Internet Explorer". Like Windows Explorer is the fastest horse in the stable!

    It can take minutes to delete a file, it can take forever to update a view if there are network resources that just happen to be unavailable. Gee, Explorer, give up trying, my patch cord is not even plugged!

Comments are closed.