- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
So the actual action was determined not only by whether there was one click or two, but by when the timer event occurred?
Phew!
Admin
There's a timer involved in this? How can you tell? I mean, the object (?) name tmrClickTimer is sort of vague on this.
Admin
Help! Help! My square wheel doesn't roll very well!
Admin
I am not a VBguy so I might not be up on all the fiddly bits, but near as I can tell actually clicking the button does not initiate any action. It simply flips this toggle button. I am calling it a toggle button because it will toggle between two states until the timer comes along a clears it again to the empty state.
An FSM should look like the following I believe.
empty state ---> 1.click <---[ click event]---> 2.click
So, depending on the duration of the timer you might be in any state as the user clicks the button (does not see anything happen) then clicks a few more time.
Thus Click2 is more like State 2.
Admin
If the timer fires between the user's first click and second click, you'll end up with 2 single-click events, instead of a single, uh, dual-click (not the same as a double click evidently). I'm curious as to what the timer interval was set to. Too fast and you'll have a problem dual-clicking, too slow and the user will be waiting for their single-click to process.
Admin
wow... this is user interface design at its most obfuscated... not only is there a timer involved, but it acts like a queue to hold all the different requests... polling its own tag value to see just what's up... what happens if the user clicks three times? the value is set back to 1. and no indication that this will happen, either -- like, say, changing the label name to indicate that different actions will be taken depending on whether the number of clicks is odd or even.
this is teh lame.
Admin
This "Click2" technology is sure to revolutionize the world of user interface design.
Admin
That's just funny. They have the ability to extend it beyond two clicks though ... triple click anyone?
Admin
just when i was starting to think that MY job sucks....
click2 saves the day....
Admin
Maybe the programmer just wanted a different maximum time interval than you get with DblClick.
Admin
Damn, even if you didn't know that there was a double-click event, why not just keep a LastClickTime variable?
Admin
That is was a trade secret. [:)]
Admin
Also, let's not ignore the lines:
'MsgBox "Unknown Button: " & aryArgs(1)
Commented-out, which to me says "I could figure out why I was getting the error message, but it's easier just to silence it".
Admin
It looks like it is used on multiple controls, therefore he needs to know which control was (double) clicked on...
<SNIP>
'Click twice if already clicked
If tmrClickTimer.Tag = "1.lblSetText" Then
tmrClickTimer.Tag = "2.lblSetText"
Else
tmrClickTimer.Tag = "1.lblSetText"
End If
<SNIP>
Select Case aryArgs(1)
Case "cmdLoadFile"
Call cmdLoadFile_Click
<SNIP>
Not that that is an excuse for this abomination... [6]
Actually this reminds me of something I ran across last week... someone re-invented the case statement in vbscript. Now to find it again and send it in [:O]
Admin
In fact, it's very easy to make it go to ELEVEN!!!!!!!!!!
Admin
lol. It must be for a program with people who click verrry slowwwly.
Admin
Doh! Apparently I've never used a forum before. I meant to quote this and to say that it must be for people who click very slowly. *But really*, I think it's a simple case of over-architecting. I do it when I get bored [:)] You know, like a Rube-Goldberg illustration. (Please don't flame me, It's just a joke!)
Admin
I can't (and won't) defend the implementation, but I wouldn't be surprised if this was the result of one or more users who couldn't master the double click. Some people have a very hard time double clicking for some reason, and the developer may have been told to "Make it work!!!!"
Admin
Ah... There's nothing quite like working with an app that not only implements double click incorrectly but ignores your double click speed setting in Whendoes.
Admin
I'm going to use this to put a triple click easter egg into my site.
No-one will ever find it!
Admin
What happens if the user does a genuine double-click? IIRC, you will get one Click event, then a DblClick event? So this code will count it as a single click?
Admin
My old boss showed me one that he created with a triple right-click once.
Admin
Actually, you have to click kinda fast, because if a tmrClickTimer_Timer occurs between the first and second clicks, you get two first clicks.
Admin
The triple click has actually been implemented in a lot of products. For example, in many windows apps you double-click to select a word, then click again (a.k.a triple click) to select the whole line.
The only logical reason I can see for this code to exist (and im stretching a bit here) is so that the single-click event doesnt fire if they double click, and ONLY the double click event fires. Kind of sucks to have to wait .5 seconds (or whatever) for your single click to be processed though.
Admin
what happened to using 2 buttons?
Admin
or could it be that he didn't know or understand lblSetText_DblClick() event?
Admin
Ignoring the fact that I don't know anything about how timers in VB6 work, I wonder what will happen if for example the call to "cmdLoadFile_Click" takes longer than a single timer interval ??
Admin
The point, though, is that even if you implement both the lblSetText_Click() event and the lblSetText_DblClick() event, both will fire when you double click. The Click event will fire first, then the DblClick event will fire afterward. With this based approach, you could have a "1 or the other" type approach, which isnt really possible otherwise.
Like I said, its a stretch, but could explain the thinking.
Admin
Hmm. A solution to incompatible single-click and double-click handling. Could be. That's a fine bit of forensic pathology you did there.
Admin
Lets just say that I have to work with people who may or may not use this kind of approach for things..... on a regular basis....
Admin
WTF! Double click is the most human interface invented. All because back in 1984 Apple wanted to advertise that you couldn't push the wrong button. Windows is slowly moving away from this. Everyone else is trying too, because it does not work.
Have you ever watched an old person try to double click something? It is frusterating. It is hard to hold the mouse still while clicking within the allotted time (actually holding the mouse still while clicking is difficult). The allotted time cannot be safely increased because power users are unwilling to wait any longer when they want two single clicks.
Admin
Yeah I hear they're moving away from monitors and speakers too because they're way too hard for deaf mutes to use.
Admin
It would have to be quite the PHB to tell a developer that, because now there's a double click that is even harder to use. When you try to double click, sometimes you get a double click, sometimes you get two single clicks even when clicking exactly the same way, depending on some invisible timer event. Or you're trying to single click: You click. Nothing happens (timer event hasn't occurred yet), so you click again. Oops. Double click. You're such a luser.
Of course, there are lots of users that have trouble with double click, but the solution is to not use double click, except as a shortcut for the non-digitally-challenged to do something that can be done with menus or something.
As for doing this to prevent a single click event firing when double clicking, the WTF is that the developer doesn't understand double clicking. It should always do the single click action (generally selection), then augment it some way (e.g., execute dialog box action or open properties box).
Let me guess: he wants to support double clicking of "buttons." That might explain why he's got clicking and double clicking of labels and images. That's just a plain bad idea. You want some sort of power-user activation of buttons? Try metakey-clicking.
I bet he supports double clicking of checkboxes too.
--RA
Admin
Wow, damn. I try to defend VB programmers since I know we are not the best in the world, but I can't defend this. Using a timer...to figure out a double click... I suppose the timer thing is an OK way of doing it, but it still feels dirty. Especially when you consider that the DblClick event already exists...
You heard it here folks, the pro-VB troll just shot down one of his own. Right now Ghandi is having a snowball fight with Mother Theresa in Hell.
Admin
Now I'm ready for the morse code button
Click for short, dblClick for long
<font style="font-family: courier new;" size="3">.-- - ..-.
</font>
Admin
Settings/Control Panel/Mouse: "Double-click speed" is on the first tab.
Admin
Nonsense. It's a bit of a nuisance to set up, and does require setting a timer, but the procedure for handling a "double click without doing the single click action" is fairly easy, widely documented and widely used --On any window (in MSWindows) single click on the icon in the upper left corner, and the menu displays. Double click and the window closes without the menu appearing.
Basically, you tell the control to only send single click notifications. When a click event occurs, you set a timer for the double-click timeout. If a second click arrives before the timer ticks, do the double-click action and kill the timer. If not, on the timer tick, do the single click action (and kill the timer)
So, basically, he's sorta on the right track. The WTF here is that the timer is constantly going and is asynchronous with the clicks..
Admin
My "web savvy" wife must be hip to this functionality, since she annoying clicks every link on the web twice.
Admin
Totally. It be nice if there were some way to like, I don't know, set the double-click speed. There isn't one that I know of. Not in the control panel. Definitely not under 'mouse' and not in the 'double click speed' section.
Admin
I guess I should have said "without an approach LIKE this". I am certainly not defending this guy's code by any means, just trying to figure out what the intent was. There is no standard way to keep a click event from firing while trapping a double click. It really doesnt make sense that there should be a way to do this standardly, as the first part of the double-click is a single-click, which should fire an event.
FWIW, your solution is mighty similar.
Admin
Just so you all know and don't die wondering, the programmer didn't realise there was a double-click event.
So, don't credit him for forward thinking for triple clicks and the like - it was a double-click replacement due to a lack of knowledge about VB (and this was from a guy with 3-4 years VB experience).
Admin
That wasn't 3-4 years experience. That was 3-4 days, repeatedly.
Admin
3-4 years VB experience is not enough to
learnnotice dblClick event?It used to piss me off when I was looking for a job, and some recruiters wouldn't even talk to me 'cause job requirements asked for 5 years exp., while I only had 3 or 4. Now it makes sense...
Admin
The code is horrifying, but here's my mild defense: In VB6, there's no _DblClick event on CommandButtons.
But I think there's a pretty good reason for that.
Admin
I have a faith in M$ implementation of DblClick event.
But sometimes when you think there is just too many bugs in M$ lib's, you might as well go with "Click2"...
All "Click2" needs now is a GPL license...
Admin
Uhhh.. which version of Windows are you using there? When I double click on the icon, the menu does appear for a split-second.
Admin
Maybe his boss is the type that expects that clicking many times on a button makes the damn program work faster (like those that expect that pressing again and again on the elevator's button will make it arrive faster), therefore requiring to know how many times the user clicked [:P]
PS: yes, I need sleep, lol..
Admin
OMGWTF..... is there a petition where i could sign in support of the litigation against that certain company? I guess the decision has been made "And the programmer of the year award goes to.......for his groundbreaking role in inventing Click2 and saving the computing world". I wish there was a emoticon for screaming out LOUD.
Admin
Now that you mention it, so does mine....
Admin
I won't flame you, but Rube Goldberg needs a flame or two. I'd never seen his work before now, but apart from using only one of his cartoons to describe excess detail/work, the rest a pretty useless. Each one is the same joke over again. I fail to see how anyone could ever in all time remain amused by these drawings longer than halfway through the first one they ever see.