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

StringGRid可以按下enter跳下一筆嗎?

尚未結案
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-08-25 08:31:09 IP:61.229.xxx.xxx 未訂閱
想請教一下,我在用stginggrid時,在屬性中有找到用tab往下一筆跳,但找不到用enter跳下一筆,可否麻煩的幫一下,我找了很久都找不到。
暗黑破壞神
版主


發表:9
回覆:2301
積分:1627
註冊:2004-10-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-08-25 08:36:00 IP:210.64.xxx.xxx 未訂閱
可以。 查一下站內文章應可以找到
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-08-25 08:58:12 IP:222.35.xxx.xxx 未訂閱
procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin if (Key in [#13]) then SelectNext(ActiveControl, True, True); end;
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-08-25 09:47:48 IP:61.229.xxx.xxx 未訂閱
試過了,沒有反應咧。 因為我還有做只可以輸入數字的判斷。但是我試過只放大大的語法,結果也是沒有辦法跳下一筆。
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-08-25 12:19:09 IP:222.35.xxx.xxx 未訂閱
你是不是只要调到下一行,那可以这样: procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin if (Key in [#13]) then StringGrid1.row := StringGrid1.row 1; end;
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#6 引用回覆 回覆 發表時間:2005-08-26 09:33:22 IP:61.229.xxx.xxx 未訂閱
你是不是只要调到下一行,那可以这样: procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin if (Key in [#13]) then StringGrid1.row := StringGrid1.row 1; end; 謝謝告知了,這段程式可以按enter往下一行,但是只要我key in的時候,就會做一次動作,但row是有範圍的,如果超出row的範圍的話,會出現錯誤超出範圍。
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#7 引用回覆 回覆 發表時間:2005-08-26 12:45:31 IP:222.35.xxx.xxx 未訂閱
procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin    if (Key in [#13]) then    IF StringGrid1.row'' THEN //这个条件你可以更具你的实际情况定义就可以了 StringGrid1.row := StringGrid1.row 1; end; 發表人 - cxg 於 2005/08/26 12:48:26
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#8 引用回覆 回覆 發表時間:2005-08-26 12:50:16 IP:222.35.xxx.xxx 未訂閱
怎么贴上去的和我写的内容不一样呢?不知道为什么。 procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin if (Key in [#13]) then IF StringGrid1.row < StringGrid1.ROWCOUNT-1 THEN IF StringGrid1.CELLS[0,StringGrid1.row 1]<>'' THEN //这个条件你可以更具你的实际情况定义就可以了 StringGrid1.row := StringGrid1.row 1; end;
HM
初階會員


發表:21
回覆:32
積分:25
註冊:2004-11-17

發送簡訊給我
#9 引用回覆 回覆 發表時間:2005-08-26 13:24:23 IP:220.130.xxx.xxx 未訂閱
If key = #13 Then Begin If StringGrid1.Row < (StringGrid1.RowCount - 1) Then StringGrid1.Row := StringGrid1.Row 1 Else If StringGrid1.Row = (StringGrid1.RowCount-1) Then Exit End;
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#10 引用回覆 回覆 發表時間:2005-08-26 15:27:14 IP:61.229.xxx.xxx 未訂閱
謝謝了,功能大致上已經可以了,額外想問的一點是,有什麼地方會設定到,而造成按下enter鍵時,會沒有任何反應嗎?
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#11 引用回覆 回覆 發表時間:2005-08-26 16:11:51 IP:61.229.xxx.xxx 未訂閱
謝謝了,問題已經解決了。 但是遇到最後一筆的時後,不會做離開的動作。 If key = #13 Then Begin If StringGrid1.Row < (StringGrid1.RowCount - 1) Then StringGrid1.Row := StringGrid1.Row 1 Else If StringGrid1.Row = (StringGrid1.RowCount-1) Then Exit End;
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#12 引用回覆 回覆 發表時間:2005-08-26 16:20:59 IP:61.229.xxx.xxx 未訂閱
謝謝了,問題已經解決了。
sport_jeff
一般會員


發表:4
回覆:8
積分:2
註冊:2004-01-03

發送簡訊給我
#13 引用回覆 回覆 發表時間:2005-08-26 16:35:35 IP:61.229.xxx.xxx 未訂閱
引言: 謝謝了,問題已經解決了。 想在請教個問題,如果要讓裡面的第二行都做金額三位一撇的話,應該要寫在哪個直件中?例:12345=>12,345
taishyang
站務副站長


發表:377
回覆:5490
積分:4563
註冊:2002-10-08

發送簡訊給我
#14 引用回覆 回覆 發表時間:2005-08-26 16:49:36 IP:210.68.xxx.xxx 未訂閱
PO程式碼的方式可以參考版規說明
系統時間:2024-05-19 12:43:44
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!