Tap and hold problem

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi!
I¨ve got a EraseButton on my app, if the user press the
button the last letter in a label will be deleted.
Now to my problem, if the user "tap and hold" the erase
button I want all text in the label to be deleted after
about 1 sec.
I've tried a cpuple og things but I failed all the time,
please give me a hint how to solve it!

Thanks Mike
 
Are you using a ContextMenu? If not, you an add one and specifiy it as the
textboxes contextmenu. Then when the user clicks on it, you present him
with the delete option.

HTH,

Bill
Hi!
I¨ve got a EraseButton on my app, if the user press the
button the last letter in a label will be deleted.
Now to my problem, if the user "tap and hold" the erase
button I want all text in the label to be deleted after
about 1 sec.
I've tried a cpuple og things but I failed all the time,
please give me a hint how to solve it!

Thanks Mike
 
Thanks!
But in this case I would like the user to press and hold
for about 1 sec, and then the text in the label should be
deleted.
Is it possible?

//Mike
 
There's an event on the Context Menu, Popup which you could send the delete
textbox stuff too immediately. HOwever, I'm thinking that's probably not
what you are after....

How about this approach instead....On MouseDown, start a timer control or a
timer from Threading.Timer. If the tick count equals 2000 (or the
equivalent of Two Seconds then delete the text. On MouseUp, stop the timer.
No contextmenu and it should do what you want.

HTH,

Bill
Thanks!
But in this case I would like the user to press and hold
for about 1 sec, and then the text in the label should be
deleted.
Is it possible?

//Mike
 
Should work. And don't forget to use Control.Invoke when deleting text on
timer event - Threading.Timer calls your delegate on a separate thread.
 
Thanks!
Looks like a good idea!
But I cant get my btnErase_MouseUp event to work, I just
put a msgbox in the event but nothing happends!
What can be wrong? My PDA?

//Mike
 
MouseUp event will not fire on Button control. It is not supported on it.
Since you are using a timer, you can poll the stylus state by calling
GetAsyncKeyState(1) and comparing it to 0x8000

[DllImport("coredll")]

extern static short GetAsyncKeyState(int key);


if ( (GetAsyncKeyState(1) & 0x8000) != 0 )

// Stylus is down

else

// Stylus is up;


Thanks!
Looks like a good idea!
But I cant get my btnErase_MouseUp event to work, I just
put a msgbox in the event but nothing happends!
What can be wrong? My PDA?

//Mike
 
Back
Top