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

Moving the Text cursor to a new box.

Status
Not open for further replies.

redGSRguy

Programmer
Sep 16, 2005
12
US
Right now I have a bunch of edit boxes. Only the first one is enabled. When you enter a value in the first box and hit enter it calls this function. Which saves the value and enables the next box, how do I get the typing cursor to move to the box that was just enabled? TIA.

void __fastcall TForm1::private0KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key == VK_RETURN)
{
pd0 = hex(private0->Text, 2);
test->Text = IntToHex(pd0, 2);

private1->Enabled = true;
private1->Color = clWindow;
}
}
 
Oh nevermind found something called SetFocus that does the job =D.
 
After your code enables the next box, try:
Perform(WM_NEXTDLGCTL, 0, 0);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top