Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do you repeat a character

Status
Not open for further replies.

ugly

Programmer
Jul 5, 2002
70
0
0
GB
My small dialog app contains a textbox and a button. On pressing the button a letter "a" is concatened to the text box text ie repeated pushing of the button results in a string of "a"s , thats fine but i would like to produce a series of "a"s just by holding down the button until its released, i would be very grateful of any help.

 
How about using the mouse's "left button down" event and checking if the window that has focus is the button? The example uses a variable attached to the button:
Code:
// inside the left-button down event
if (FromHandle(m_MyButton.m_hWnd) == GetFocus())
{
  // add your character with some sort of filter
  // or timer to prevent a character from being added
  // EVERY single time the event is triggered; which
  // could be zillions of characters...
}
I hope the idea makes sense.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top