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

不同元件一起執行造成衝突(Maskedit、CheckBox、RadioButton)

尚未結案
Miki-lion
中階會員


發表:90
回覆:180
積分:54
註冊:2005-04-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-07-27 17:48:41 IP:218.162.xxx.xxx 未訂閱
如附檔所示(我先將還沒寫好的元件移除了)    ㄧ共有Maskedit、CheckBox、RadioButton3個元件在    個別的功能就是輸入(或是點選),    則會在另一Page上的RichEdit(有內建內容)出現輸入的內容    或是在程式碼內寫好的識別字,輸入的位置在程式碼內就寫好。    如果個別的執行就可以正常的顯示,如果一起執行2個以上不同元件    就會吃掉後面的字句    EX: 正確是   File:[輸入的內容];   錯誤是   File:[輸入的內容            (];被吃掉了) 要如何讓他一起執行也不會去衝突到呢? 因為我的宣告幾乎在3個元件內都是一樣的,是這個問題嗎? 程式碼都是從RedSnow前輩指導的MaskEdit,修改成其他2個元件 執行檔:www.cyut.edu.tw/~s9127073/Project1.exe 程式碼:每個"同樣"的元件程式碼都一樣重複 MaskEdit
int col = 12;  // 要處理的欄位數 (Column)
    int row = 6;  // 要處理的行數 (Row)
    if (RichEdit2->Lines->Count < row 1) { // 如果 RichEdit 行數不足 10 行
        for (int i=RichEdit2->Lines->Count; i<10; i  ) {
            RichEdit2->Lines->Add("");  // 產生足夠的空行
        }
    }        AnsiString temp = RichEdit2->Lines->Strings[row];  // 設 temp 為 RichEdit1 第 row 行的內容
    AnsiString t1 = MaskEdit4->Text;  // 設 t1 為 MaskEdit4 的內容
    AnsiString t2 = MaskEdit5->Text;  // 設 t2 為 MaskEdit5 的內容
    AnsiString t3 = MaskEdit6->Text;
    int len1 = t1.Length();  // 設 len1 為 MaskEdit4 的字數
    int len2 = t2.Length();  // 設 len2 為 MaskEdit5 的字數
    int len3 = t3.Length();  // 設 len2 為 MaskEdit6 的字數
    if (len1 > 0 || len2 > 0 || len3 > 0) {
        int len = temp.Length();  // 設 len 為 RichEdit 第 row 行內容的字數
        if(len < col){  // 如果資料行字元數少於 col 值,則以空白字元補足它
            RichEdit2->Lines->Strings[row] = temp   AnsiString::StringOfChar(' ', col - len);
            temp = RichEdit2->Lines->Strings[row];
        }            if(len1 > 0){  // 如果 MaskEdit4 有內容
            t1 = "%" t1;  // 在 t1 前加上 % 符號
        }
        if(len2 > 0){  // 如果 MaskEdit5 有內容
            t2 = "%" t2;  // 在 t2 前加上 % 符號
        }
        if(len3 > 0){  // 如果 MaskEdit6 有內容
            t3 = "%" t3;  // 在 t3 前加上 % 符號
        }            temp = temp.SubString(1, col-1)   t1   t2   t3   temp.SubString(col oldlen, temp.Length()-((col oldlen)-1));
        oldlen = t1.Length()   t2.Length()  t3.Length();   // 設定 oldlen 為3個 MaskEdit 內容的長度 (包含 % 符號在內)
    } else {
        temp = temp.SubString(1, col-1)   temp.SubString(col oldlen, temp.Length()-((col oldlen)-1));
        oldlen = 0;
    }        RichEdit2->Lines->Strings[row] = temp; // 將重新組合過的字串設回給 RichEdit 第 row 行 
CheckBox
 
int col = 14;  // 要處理的欄位數 (Column)
    int row = 34;  // 要處理的行數 (Row)
    AnsiString t1 ;
    AnsiString t2 ;
    AnsiString t3 ;
    AnsiString t4 ;
    if (RichEdit2->Lines->Count < row 1) { // 如果 RichEdit 行數不足 10 行
        for (int i=RichEdit2->Lines->Count; i<10; i  ) {
            RichEdit2->Lines->Add("");  // 產生足夠的空行
        }
    }        AnsiString temp = RichEdit2->Lines->Strings[row];  // 設 temp 為 RichEdit1 第 row 行的內容
    if(CheckBox5->Checked)
    {
    t1 = "delspace";
    }        if(CheckBox6->Checked)
    {
    t2 = "deltab";
    }        if(CheckBox6->Checked)
    {
    t3 = "dellinefeed";
    }        if(CheckBox6->Checked)
    {
    t4 = "delexplanatory";
    }        int len1 = t1.Length();  
    int len2 = t2.Length();  
    int len3 = t3.Length();  
    int len4 = t4.Length();
    if (len1 > 0 || len2 > 0 || len3 > 0 || len4>0) {
        int len = temp.Length();  // 設 len 為 RichEdit1 第 row 行內容的字數
        if(len < col){  // 如果資料行字元數少於 col 值,則以空白字元補足它
            RichEdit2->Lines->Strings[row] = temp   AnsiString::StringOfChar(' ', col - len);
            temp = RichEdit2->Lines->Strings[row];
        }            if(len1 > 0){  
            t1 = "%" t1;  // 在 t1 前加上 % 符號
        }
        if(len2 > 0){  
            t2 = "%" t2;  // 在 t2 前加上 % 符號
        }
        if(len3 > 0){  
            t3 = "%" t3;  // 在 t3 前加上 % 符號
        }
        if(len4 > 0){  
            t4 = "%" t4;  // 在 t3 前加上 % 符號
        }            temp = temp.SubString(1, col-1)   t1   t2   t3   t4  temp.SubString(col oldlen, temp.Length()-((col oldlen)-1));
        oldlen = t1.Length()   t2.Length()  t3.Length()  t4.Length();   
    } else {
        temp = temp.SubString(1, col-1)   temp.SubString(col oldlen, temp.Length()-((col oldlen)-1));
        oldlen = 0;
    }        RichEdit2->Lines->Strings[row] = temp; // 將重新組合過的字串設回給 RichEdit 第 row 行
RadioButton
int col = 12;  // 要處理的欄位數 (Column)
    int row = 28;  // 要處理的行數 (Row)
    AnsiString t1 ;
    AnsiString t2 ;
    AnsiString t3 ;
    AnsiString t4 ;
    if (RichEdit2->Lines->Count < row 1) { // 如果 RichEdit 行數不足 10 行
        for (int i=RichEdit2->Lines->Count; i<10; i  ) {
            RichEdit2->Lines->Add("");  // 產生足夠的空行
        }
    }        AnsiString temp = RichEdit2->Lines->Strings[row];  // 設 temp 為 RichEdit1 第 row 行的內容
    if(RadioButton3->Checked)
    {
    t1 = "del";
    }        if(RadioButton4->Checked)
    {
    t2 = "replace";
    }        if(RadioButton5->Checked)
    {
    t3 = "frontinsert";
    }        if(RadioButton6->Checked)
    {
    t4 = "behindinsert";
    }        int len1 = t1.Length();  // 設 len1 為 MaskEdit1 的字數
    int len2 = t2.Length();  // 設 len2 為 MaskEdit2 的字數
    int len3 = t3.Length();  // 設 len2 為 MaskEdit2 的字數
    int len4 = t4.Length();
    if (len1 > 0 || len2 > 0 || len3 > 0 || len4>0) {
        int len = temp.Length();  // 設 len 為 RichEdit1 第 row 行內容的字數
        if(len < col){  // 如果資料行字元數少於 col 值,則以空白字元補足它
            RichEdit2->Lines->Strings[row] = temp   AnsiString::StringOfChar(' ', col - len);
            temp = RichEdit2->Lines->Strings[row];
        }            if(len1 > 0){  // 如果 MaskEdit1 有內容
            t1 = "%" t1;  // 在 t1 前加上 % 符號
        }
        if(len2 > 0){  // 如果 MaskEdit2 有內容
            t2 = "%" t2;  // 在 t2 前加上 % 符號
        }
        if(len3 > 0){  // 如果 MaskEdit1 有內容
            t3 = "%" t3;  // 在 t3 前加上 % 符號
        }
        if(len4 > 0){  // 如果 MaskEdit1 有內容
            t4 = "%" t4;  // 在 t3 前加上 % 符號
        }            temp = temp.SubString(1, col-1)   t1   t2   t3   t4  temp.SubString(col oldlen, temp.Length()-((col oldlen)-1));
        oldlen = t1.Length()   t2.Length()  t3.Length()  t4.Length();   // 設定 oldlen 為兩個 MaskEdit 內容的長度 (包含 % 符號在內)
    } else {
        temp = temp.SubString(1, col-1)   temp.SubString(col oldlen, temp.Length()-((col oldlen)-1));
        oldlen = 0;
    }        RichEdit2->Lines->Strings[row] = temp; // 將重新組合過的字串設回給 RichEdit 第 row 行
 
發表人 - miki-lion 於 2005/07/27 17:55:46 發表人 - miki-lion 於 2005/07/27 18:01:11 發表人 - miki-lion 於 2005/07/27 18:02:32
Miki-lion
中階會員


發表:90
回覆:180
積分:54
註冊:2005-04-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-07-28 11:20:27 IP:218.162.xxx.xxx 未訂閱
這問題真的是超多的,我想有點難度在 如果真的不行的話我只好將內建格式改成 File: 後面不接任何東西,這樣也是變通的方法啦,只是很奇怪為何會這樣子><
系統時間:2024-05-13 14:21:12
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!