2012-09-25 2 views
1

TCL Tk를 처음 사용하고 Tk 테이블을 사용하여 GUI에 테이블을 만듭니다.TCL 테이블의 Tk 테이블에서 전체 열을 비활성화하는 방법

Basically it contains some hardware register's info like its name, address, value....etc. 
Now i want that user should not be able to change the register address and name and hence i 

Tk 테이블의 이름과 주소 열을 완전히 비활성화하고 싶습니다. 아무도 내가 어떻게 할 수 있는지 말해 줄 수 없어. 나는 이것을 오랫동안 노력하고있다. 도와주세요.

답변

1

Tk에는 테이블 위젯이 내장되어 있지 않으므로 here에서 Tktable/Tile을 사용하고 있다고 가정합니다.

다음은 필자가 사용하지 않은 2 개의 열을 함께 던진 예입니다. 기본적으로 -coltag 명령과 함수를 사용하여 편집하려는 모든 항목을 특정 태그에 할당 한 다음 state와 같은 속성을 해당 태그에 적용합니다.

package require Tktable 


array set cells { 
    0,0 David 0,1 "1234 Fake st" 0,2 foo 
    1,0 John 1,1 "444 New York Ave" 1,2 bar 
} 

# This function returns the tag to assign to all cells in col $col 
proc tagCol col { 
    # If we're name or address column, add the disabledColumn tag to it 
    if {$col == 0 || $col == 1} { 
     return disabledColumn; 
    } 
} 

table .mytable -rows 2 -cols 3 -variable cells -coltagcommand tagCol 

# Disable editing of the disabled column entries 
.mytable tag config disabledColumn -state disabled -fg blue 

pack .mytable 
+0

도움 : 트리 "열"을 해제하여 treeview'. –

0

당신은 또한 옵션 의 -titlerows 'n'을-titlecols 'm' 먼저 'N'행은 제목을 읽도록 상태로, 또는 첫 번째 'm'COLS는 읽기를 사용할 수 있습니다 단 제목.

희망 나는 당신은`TTK있는 테이블 위젯을 시뮬레이션 할 수 있습니다

관련 문제