Wolfsnap Posted August 29, 2003 Posted August 29, 2003 Anybody have any simple code to create a "While MouseDown" event? Any help would be greatly appreciated! Quote
*Experts* mutant Posted August 29, 2003 *Experts* Posted August 29, 2003 There is no such an event as "While MouseDown", are you having some problems with MouseDown event and dont want to use it or what? :) Quote
Wolfsnap Posted August 29, 2003 Author Posted August 29, 2003 The problem I'm having is this. I'm developing a control panel interface for a piece of machinery. I need a momentary contact button on the interface, which sends and reads addresses from an industrial PLC. When using just the MouseDown and MouseUp events, if a user just "pokes" the button, the MouseUp event doesn't communicate with the PLC in time. If I start a timer in the MouseDown event to prevent it, then the button hangs if pushed, held, quickly released and hit again. I know, what are the chances that someone's going to do that - but this is a control for an industrial grinder - and I can't take the chance. What I need is some sort of event that checks if the mouse is down, and if so, do an instruction - and if not, stop that instruction. Would there be a way to call on the MouseDown event as a RaiseEvent to check for it's condition inside of a "while" loop? "I hope that didn't sound as silly as it did to me when I wrote it.) Quote
*Experts* Nerseus Posted August 29, 2003 *Experts* Posted August 29, 2003 If I understand you correctly, you could set a form level flag such as bMouseIsDown in the MouseDown/MouseUp events. In the MouseDown (of a button, a label or whatever you want) set the flag to true and call some function that loops and does what's needed. Make sure the loop has a call to Application.DoEvents so that you can pick up the window events. You can exit the loop when the variable is false. Is that what you were looking for? -Ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Wolfsnap Posted August 29, 2003 Author Posted August 29, 2003 That sounds about right - Literally what I need to do is set bit in the PLC to true when the mouse is down, but only when the mouse is down - otherwise the bit is set to false. What I have tried is to set the bit in a MouseDown event, and reset the bit in the MouseUp event - but the communication lag (or something?) keeps the MouseUp event from reaching the PLC. BTW - dunno if this makes any difference, but this is a touch screen (so MouseEnter/Hover events wouldn't really work either) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.