Chat BCB
(Copyright requirements: This article must not be reproduced in addition to 9CBS authorization or the author
Learning BCB is also three years, I always want to write something, I have a bitterness and pleasure of myself, learn something difficult, so that everyone will live together. But I feel that these things have no help to beginners, or write some real questions for learning BCB, but you can declare just chat, some content can only be able to get angry: P: P
Maskedit
Maskedit is used to establish an edit box, but it can enter any character with the Edit Editing box, Maskedit can limit the user only in the established input format. This provides a lot of convenience to the data input to some standard formats. Let's take a look at it different from the EDIT.
[Editmask] attribute, this property is used to set the format of the user, and if the user entered characters do not match the format requirements, this character will be rejected.
How to set the format? Click on the "..." "...", you will pop up a dialog box that sets the format, where you can choose the format you need. But sometimes we want to set up in the program, or there is no format we want at all in the existing format, what should I do?
It seems that there is any mask in dbase, don't you know? The answer is certain, she also has a mask character table that is almost DBASE, let's take a look at this table:
Mask character table
Mask character meaning! Remove the space for entering the data> Let the letters of the input data become uppercase until you encounter a mask character <
Example: Phone number →! / (9999 /) 999999999; L; _
Japanese issue →! 0000/99/99; l;
[Text], [edittext] This is always wrong because they are too elephant, but they still have a little different. If you want to return to the format, you can only use Edittext, if you check Whether this text is empty, you have to use Textj
There is also an important way. Don't forget it, it is validateEdit (). What is she doing? Check if the text content you entered is in line with Maskedit's format requirements. If it does not meet, there is no way, return to re-enter.
Haha, this block, you should understand it.
// The following is just part of a program
......
Maskedit1-> editmask = "! 0000/99/99; l;"
......
IF (maskedit1-> text == "")
{
ActiveControl = maskedit1; // Put the focus to maskedit1
Maskedit1-> ValidateEdit (); label1-> caption = maskedit1-> editText;
......
}
I think we just have to master Maskedit is enough, what do you say?
Do you have anything to say, of course, or talk about it next time, and go to J