全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2555
推到 Plurk!
推到 Facebook!

EditMask問題

尚未結案
shing.net
中階會員


發表:207
回覆:124
積分:66
註冊:2002-03-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-01-16 14:37:56 IP:140.122.xxx.xxx 未訂閱
請問若一TDBDate其EditMask設為!9999/99/99;1; 若其欄位要輸入日期其會自動產生____/__/__ 若我不要輸入日期應如何去除 / / 因為系統會出現____/__/__為無效之日期格式
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-01-16 14:47:00 IP:61.218.xxx.xxx 未訂閱
引言: 請問若一TDBDate其EditMask設為!9999/99/99;1; 若其欄位要輸入日期其會自動產生____/__/__ 若我不要輸入日期應如何去除 / / 因為系統會出現____/__/__為無效之日期格式
Represents the mask that validates and formats user input. Unit MaskUtils type TEditMask = type string; Description TEditMask is a string that consists of three fields with semicolons separating them. The first part of the mask is the mask itself. The second part is the character that determines whether the literal characters of a mask are saved as part of the data. The third part of the mask is the character used to represent unentered characters in the mask. These are the special characters used in the first field of the mask: Character Meaning in mask ! If a ! character appears in the mask, optional characters are represented in the text as leading blanks. If a ! character is not present, optional characters are represented in the text as trailing blanks. > If a > character appears in the mask, all characters that follow are in uppercase until the end of the mask or until a < character is encountered. < If a < character appears in the mask, all characters that follow are in lowercase until the end of the mask or until a > character is encountered. <> If these two characters appear together in a mask, no case checking is done and the data is formatted with the case the user uses to enter the data. \ The character that follows a \ character is a literal character. Use this character to use any of the mask special characters as a literal in the data. L The L character requires an alphabetic character only in this position. For the US, this is A-Z, a-z. l The l character permits only an alphabetic character in this position, but doesn't require it. A The A character requires an alphanumeric character only in this position. For the US, this is A-Z, a-z, 0-9. a The a character permits an alphanumeric character in this position, but doesn't require it. C The C character requires an arbitrary character in this position. c The c character permits an arbitrary character in this position, but doesn't require it. 0 The 0 character requires a numeric character only in this position. 9 The 9 character permits a numeric character in this position, but doesn't require it. # The # character permits a numeric character or a plus or minus sign in this position, but doesn't require it. : The : character is used to separate hours, minutes, and seconds in times. If the character that separates hours, minutes, and seconds is different in the regional settings of the Control Panel utility on your computer system, that character is used instead. / The / character is used to separate months, days, and years in dates. If the character that separates months, days, and years is different in the regional settings of the Control Panel utility on your computer system, that character is used instead. ; The ; character is used to separate the three fields of the mask. _ The _ character automatically inserts spaces into the text. When the user enters characters in the field, the cursor skips the _ character. Any character that does not appear in the preceding table can appear in the first part of the mask as a literal character. Literal characters must be matched exactly in the edit control. They are inserted automatically, and the cursor skips over them during editing. The special mask characters can also appear as literal characters if preceded by a backslash character (\). The second field of the mask is a single character that indicates whether literal characters from the mask should be included as part of the text for the edit control. For example, the mask for a telephone number with area code could be the following string: (000)_000-0000;0;* The 0 in the second field indicates that the Text property for the edit control would consist of the 10 digits that were entered, rather than the 14 characters that make up the telephone number as it appears in the edit control. A 0 in the second field indicates that literals should not be included, any other character indicates that they should be included. The character that indicates whether literals should be included can be changed in the Edit Mask property editor, or programmatically by changing the MaskNoSave typed constant. The third field of the mask is the character that appears in the edit control for blanks (characters that have not been entered). By default, this is the same as the character that stands for literal spaces. The two characters appear the same in an edit window. However, when a user edits the text in a masked edit control, the cursor selects each blank character in turn, and skips over the space character. Note: When working with multibyte character sets, such as Japanese Shift-JIS, each special mask character represents a single byte. To specify multi-byte characters using the L, l, A, a, C, or c specifiers, the mask characters must be duplicated as well. For example, LL would represent two single-byte alphabetic characters or a one double-byte character. Only single-byte literal characters are supported.
------
︿︿
T.J.B
版主


發表:29
回覆:532
積分:497
註冊:2002-08-14

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-01-16 14:47:55 IP:61.220.xxx.xxx 未訂閱
引言: 請問若一TDBDate其EditMask設為!9999/99/99;1; 若其欄位要輸入日期其會自動產生____/__/__ 若我不要輸入日期應如何去除 / / 因為系統會出現____/__/__為無效之日期格式
在 FORMCREATE 事件 或 FORMSHOW事件 寫
 ShortDateFormat := 'yyyy/mm/dd';
就不會錯誤訊息了 天行健 君子當自強不息~~@.@
------
天行健
君子當自強不息~~@.@
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-01-16 15:46:10 IP:211.78.xxx.xxx 未訂閱
引言: 請問若一TDBDate其EditMask設為!9999/99/99;1; 若其欄位要輸入日期其會自動產生____/__/__ 若我不要輸入日期應如何去除 / / 因為系統會出現____/__/__為無效之日期格式
你可以這樣 1.在該TDBDATE的ONKEYDOWN下寫
     if Table1.DBdate in [dsInsert, dsEdit] then
        if (key=VK_DELETE) or (key=VK_BACK) then begin
           Table1.Edit;
           Table1Datefield.Clear;   --> 重點在這
           Table1.Post;
        end;
2.告訴客戶如果不要日期按 delete或backspace鍵來消除資料或者 你要寫成而人性化操作亦可!
系統時間:2024-05-19 6:26:35
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!