Search code examples
conventionsclick

What to consider a click?


Such a simple consept, yet so many ways to interpreit it.

I'm making a program (a game, to be spesific) using an event based library (Allegro). The library doens't have a spesific event for a mouse click, but in stead has event for button down and button up. While programming the basic menus, I was struck by a problem. What do I consider a click? The button down event? The button up event? The latter, if it happen shortly after button down? If so, from which point do I take the cursor position from?

There is no dragging functionality anywhere in the program, so all options seem equaly valid to me, with the exception of the most extreme cases perhaps (dragging the cursor long ways across the screen, for example). So my question is, are there any conventions to what to consider a click?


Solution

  • If you experiment with buttons in various programs, you'll probably find that the button triggers when you press and then release the mouse within it.

    More specifically, when you press the mouse, the button switches to a "pressed" appearance, but if you drag the mouse outside the button, the button reverts to its normal appearance, and releasing the mouse then has no effect. There is probably also another state that the button is in when you hover the mouse over it.

    For a user accustomed to modern interfaces, you really need to provide all three of these states - normal, hover, and press - in order to give them the feedback they expect for a pressable item.