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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting All text in edit box by clicking once

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
is there any way that all the text in an edit box can be selected by just one click of the mouse in the box?...been trying all ways but to no avail... help will be greatly appreciated..
 
You can add handler for WM_ONLBUTTONDOWN for Your box IDC_YOUR_CONTROL_ID and enter in the handler this code:
GetDlgItem( IDC_YOUR_CONTROL_ID)->SetFocus( );
((CEdit*)GetDlgItem( IDC_YOUR_CONTROL_ID))->SetSel( 0, -1);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top