Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
I am creating an application in C# in visual Studio 2008 where in a single button will have 2 uses and it will depend on whether the user just presses the button or long presses the button.
 
i thought of adding a timer but it is a very clumsy way and i was thinking if there was an inbuilt way for this
Posted 20 Nov '12 - 5:47
23nigam137

Comments
Sergey Alexandrovich Kryukov - 20 Nov '12 - 12:16
I answered, but in you need further detail, you need to tag you UI library you use. --SA

1 solution

Easy. Except for button press, there are lower-level events, button down and then button up. You can detect the time between these events. Further detail depends on UI library you want to use and application type, but the code would be very similar.
 
[EDIT]
 
In most applications, I would not recommend you to operate on timing between down and up events, as the users are not used to it, this is not a common UI style. But sometimes we want to go out of common UI styles, then your idea might work for you. But even then, don't assume the user will get it if you don't care about explaining this unusual feature somehow.
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 218
1 Ron Beyer 215
2 Aarti Meswania 190
3 Rohan Leuva 178
4 Mahesh Bailwal 160
0 Sergey Alexandrovich Kryukov 8,553
1 OriginalGriff 6,899
2 CPallini 3,648
3 Rohan Leuva 2,963
4 Maciej Los 2,308


Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid