Jump to content

Dual funtion Boolean (with press/hold)


jdebuhr

Recommended Posts

I am working on a UI that has a Boolean and a numeric, when the boolean is pressed and release the numeric increments. if the Boolean is held for more then 5 secs the numeric resets to 0. I have it working in windows by using an event structure with a mouse down to start a timer and mouse up to increment or reset the numeric depending on the timer value. it works great.

BUT, now they want the numeric to go to 0 before the mouse release and still after the 5 secs.. any thoughts as to how to do this?

Next part of this is I need the same function on a windows CE touchpanel, but in 8.2.1 CE does not support mouse down. anythoughts for that?

THANKS

Link to comment

QUOTE(jdebuhr @ Sep 20 2007, 08:02 AM)

BUT, now they want the numeric to go to 0 before the mouse release and still after the 5 secs.. any thoughts as to how to do this?

My initial thought: when the button goes down, put a reference to it in a shift register. In the timeout case (5 s), put the code to reset the numeric if the shift register contains a valid reference. In the mouse up case, invalidate the reference in the shift register. You'll also want to check when the mouse up happens after the numeric is reset that you don't increment it.

Link to comment

QUOTE(eaolson @ Sep 20 2007, 10:11 AM)

My initial thought: when the button goes down, put a reference to it in a shift register. In the timeout case (5 s), put the code to reset the numeric if the shift register contains a valid reference. In the mouse up case, invalidate the reference in the shift register. You'll also want to check when the mouse up happens after the numeric is reset that you don't increment it.

Hmm that might work, I will need to try it, I am using a timeout Event but can do this within it..

But this leads me to my next question in an event structure you have 'Mouse Down' and 'Mouse Down?' so if a button is pressed which event happens first?

Link to comment

QUOTE(jdebuhr @ Sep 20 2007, 06:45 PM)

Hmm that might work, I will need to try it, I am using a timeout Event but can do this within it..

But this leads me to my next question in an event structure you have 'Mouse Down' and 'Mouse Down?' so if a button is pressed which event happens first?

The 'Mouse Down?' is a filter event, it allows you to cancel the event so it is fired before the 'Mouse Down' event. It can be usefull if you don't want to change the value of a boolean after a mouse click in certain conditions.

But I wouldn't use the 'time-out' option because 5 seconds is a long time, and you have most likely other events in the same structure.

I would start a fire a second loop that waits for 5 seconds on a notifier, if the notifier is not fired the numeric will be reset. You fire the notifire on a 'mouse up'

Ton

Link to comment

I didn't understand what it is you actually want to do, so I can't provide a specific answer, but I will mention a few points. Also, I only have experience with older versions of the PDA module. I assume the touch module is similar, but there may be differences. In any case, you should test any solution you come up with on that module before implementing it, because you might find out that certain things don't work.

  • References might not work as you expect.
  • It might be advisable to change the mechanical action to Switch Until Released and use the Value Change event instead, but make sure the proper action is supported.
  • You will probably be able to get a Mouse Down event if you use a picture control instead of a boolean.
  • Don't use Mouse Down and Mouse Down? in the same event structure. It's ambiguous. Choose one of them.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.