Chat BCB (1)

zhaozj2021-02-16  41

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 < <> unlimited input data letters Is uppercase or lowercase / if you add a special character in the input format, as long as you add this mask in front of the special character. The same is true for the translivation character in the printf in the C language. Haha's appearance is also the same L. Allow input letter, and must enter L allow input English letters, do not necessarily enter a allowed to enter English Letters and arabic numbers, be sure to enter a allowed to enter English letters and arabic numbers, do not necessarily enter c Allow input any characters, be sure to enter any characters, do not necessarily enter 0 Allow input Arabic numbers, must enter 9 Allow input to Arab numbers, do not necessarily enter # Allow input arabic numbers or positive, negative characters: When used to separate time data, minutes, seconds / use to separate the date data in the date data; used to separate Mask field _ represents space character, runtime display next line 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

转载请注明原文地址:https://www.9cbs.com/read-26026.html

New Post(0)