Jump to content

UniEdit and OnKeyPress


Lena

Recommended Posts

Hi.

Please explain why not work in this code Key = 0? In VCL project not problem.

void __fastcall TUniFormAddDat::UniEdit1KeyPress(TObject *Sender, System::WideChar &Key)

{
 //Can only type numbers
 Set<char, '0', '9'>Dig;
 Dig << '0' << '1' << '2' << '3' << '4' << '5' << '0' << '6' << '7' << '8' << '9';
 if(!Dig.Contains(Key) && Key != VK_BACK)
   {
    Beep(); //I hear the sound!
    Key = 0;//<- But this does not work. UniEdit1 displays all, and numbers and letters
    
    //try test delete does not work
    //UniEdit1->Text.Delete(UniEdit1->Text.Length()-1, 1);
   }
}
Link to comment
Share on other sites

  • 8 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...