Double Click vs Single Click - are these mutually exclusive
Asked Answered
V

8

6

Can anyone name an instance of an application where clicking an entity (say image) does one thing, but if you double-click it it does something different?

The only example I've been able to find is in double-clicking a track in iTunes but then that selects it (single click function) and then plays it (double-click function) which implies (logically) that double click is the superset (containing single-click).

Basically, I am being asked to implement (in WPF) an image single-click doing one thing and an image double-click doing another thing and I'm not sure if this is even conceptually correct.

If someone has an example of anyone sensibly doing this that would be appreciated?

Vaud answered 9/6, 2009 at 15:46 Comment(0)
F
18

From a Windows messaging perspective, a double-click always generates a single click message first; Windows can't predict ahead of time that another click will come in time to turn it into a double-click. I can't imagine that WPF is going to hide this physical fact from you.

Fetich answered 9/6, 2009 at 15:49 Comment(4)
This is exactly the clarity that I'm looking for. Cheers.Vaud
You asked for application examples but were actually looking for someone to tell you how events worked on Windows? Brilliant.Franklyn
Don't get me wrong. The examples by balabaster were extremely useful too.Vaud
@jeffamaphone StackOverflow is full of that - sometimes you have to read between the lines to figure out what the user wants. You have written design specifications, right? :PCleanthes
C
11

In answer to the direct question: Double Click vs Single Click - are these mutually exclusive? The answer is no, these are not mutually exclusive due to the manner in which Windows needs to interpret your behaviour with the mouse.

However, in answer to the more vague question regarding a precedent where a double click does not include the behaviour of single click [i.e. The two events exhibit mutually exclusive behaviour], there are some specific events in Windows that appear to exhibit the behaviour you're asking about.

For instance - the taskbar applets:

  • Single click usually opens a shortcut menu for that item.
  • Double click usually opens the properties menu for the application which that task bar item is linked to without opening the shortcut menu.

The taskbar clock:

  • Single click does nothing.
  • Double click opens the Date and Time properties.

You may notice however that it takes a moment to respond to your request and as others have noted that pause is Windows waiting to see if you're going to double click. If you don't double click then the Click behaviour is fired. If you do double click then the DoubleClick behaviour is fired. In these specific situations it was deemed suitable to have mutually exclusive behaviour and there may be some others.

I think it really depends on the situation as to whether the different behaviour is "right" or "wrong" - I don't think you can equivocably say that one is right and the other wrong in all situations. If the behaviour you are looking to exhibit makes good logical sense from a user perspective [not from your own programmer perspective], then sure, make the behaviour mutually exclusive; if however it doesn't make good logical sense to the user then avoid it.

Cleanthes answered 9/6, 2009 at 15:59 Comment(7)
I notice that when you single click on a task bar icon, it takes a moment for the menu to appear. I wonder if there's special code in the single click handler to wait for the possibility of a double click?Fetich
The system notification area (aka "Tray") implements a delay before processing a single-click, which is roughly 500 ms by default, but can change based on your double-click delay. This is how that one, very specific section of the Windows UI performs that option. Under normal circumstances, this is bad UI design and breaks the Windows conventions, but in that specific case it's intentional. (About halfway down this blog entry: blogs.msdn.com/oldnewthing/archive/2009/04/30/9577283.aspx)Klong
You are right. Raymond Chen wrote on close topic recently: blogs.msdn.com/oldnewthing/archive/2009/04/30/9577283.aspx. That half-second delay is unpleasant.Civies
That's possibly the case, I can't really speak to that as I don't have a well researched answer. The behaviour could actually be suppressed as it could in any case - however, to the end user, the behaviour appears different which is inline with the question's implication.Cleanthes
@John/buti-oxa - Thanks for the link, I will read it as soon as I get a moment. I stand by my statement that you can't equivocably say it's right or wrong in all situations though. There are on occasion very good and intuitive reasons for this kind of behaviour. I was just highlighting that point using the tray/clock as two examples that sometimes this is desirable.Cleanthes
@balabaster: Absolutely, there are occasions to break UI conventions. Hence, "under normal circumstances." :) But one should always consider all of the ramifications of doing so. In most GUI scenarios, the double-click has been determined to be single click + secondary action (EG, select and act). If there's not a seriously compelling reason to break this user expectation, then it shouldn't be done. OTOH, if there is a seriously compelling reason to break it, then do so with knowledge of what you're doing and why.Klong
@John I agree. It's always better to make a well informed decision rather than haphazardly stumbling forward without understanding all the ramifications.Cleanthes
M
2

It's generally a bad pattern to make a double click do something unrelated to the single click behavior. In order to distinguish between the single click and the double click, you have to wait for a moment to see if the second click arrives. That can cause a disconcerting delay when you're just single-clicking something.

Raymond Chen has a good blog post on this issue, including how to do it.

But I'd push back on the designer first.

Micheal answered 9/6, 2009 at 16:12 Comment(0)
F
1

The most obvious would seem to be Finder/Explorer, where single-clicking a file selects it and double-clicking opens it. There's plenty of precedent for this sort of thing, and people are well trained by its inclusion in the OS level to expect double click to do different things.

  • Text selection (in just about every app in existence) - single click to place the cursor, double click to select the word, triple click to select the whole line.
  • Explorer / Finder - single click to select a file, double click to open it.
  • Outlook - single click to preview an e-mail, double click to open in a new window.
Factorial answered 9/6, 2009 at 15:49 Comment(1)
None of your examples show mutually exclusive actions for single and dobule clicks. Text selection: single click places cursor, double click -, select word AT ALREADY SELECTED THE CURSOR POSITION. Explorer: single click selects the file, double click opens the ALREADY SELECTED FILE. Outlook: single click selects message and as a side effect of selcting it, shows it in preview window (if so configured), the double click opens the ALREADY SELECTED MESSAGE in its own window (and it remains in the preview view as well). In all three cases, the single click is a precursor to double click.Oxford
F
1

In Cooliris, if you click a cell in the wall, it gets selected. If you double click the image, it transitions to a full screen slide show mode, starting at that image.

Franklyn answered 9/6, 2009 at 15:49 Comment(0)
M
0

Microsoft Excel. Move your mouse over an unselected cell.

Single click = cell selection

Double click = enter edit mode for that cell

Mixedup answered 9/6, 2009 at 15:51 Comment(1)
True -- it does select the cell. But try getting to edit mode using single clicks. You can't. The edit semantics are also different between the two. If the cell is selected (but not in edit mode) the cells contents are replaced when typing. If the cell is in edit mode, typed characters are inserted at the carat. Not exactly superset/subset behavior, but good point.Mixedup
N
0

Wrapping up what's said by others here, double click does not "cancel" a single click.

As a consequence to that, you should never do something in a double-click event that depends on a state that is changed by a single click - because a single click is always executed first!

The other way around, you can rely on that the state after a single click is valid when starting the double click action. Example: Single click in a file list selects the file, so in the double click event you know that the clicked file is selected...

Noellanoelle answered 26/10, 2009 at 8:54 Comment(0)
L
0
private void OnItemMouseDown(object sender, MouseButtonEventArgs e) {
    if(e.ClickCount==2) {
        // DoubleClick Function
    }

    if(e.ClickCount==1) {
        // Click Function
    }
}
Lasalle answered 12/4, 2011 at 9:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.