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!

MaskEdit Help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
My application uses two MaskEdit components on a Form and when some numbers have been entered into the MaskEdit1 field they are then copied into the MaskEdit2 field after pressing the Return/Enter key.

MaskEdit2->Text=MaskEdit1->Text;

Under the Object Inspector Events Tab of BCB3 there doesn't seem to be anything which I can use....

How can I do this??
 
I can do it by using two events. The first is OnExit for your MaskEdit1. Insert your code there. It should look something like this:
Code:
void __fastcall TForm1::MaskEdit1Exit(TObject *Sender)
{
    MaskEdit2->Text = MaskEdit1->Text;
}

This will allow you to copy the contents of MaskEdit1 to MaskEdit2 when you press TAB. Next you need to make the ENTER key mimic the TAB key. To do this, you need to use the OnKeyPress on MaskEdit1. Your code should look like this:
Code:
void __fastcall TForm1::MaskEdit1KeyPress(TObject *Sender, char &Key)
{
    // Check to see if the ENTER/RETURN key has been pressed
    if (Key == VK_RETURN)
    {
        Key = 0; // Clear the key
        Perform(WM_NEXTDLGCTL,0,0); // Do a TAB move
    }
}
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top