You are here

always on top 기능이 안되어서요.

일단 아래 하나의 함수 입니다.

# 메모장 생성
proc createMemoWindow num {
        global currentDirectory arrayOfSM aOTop

        set fn $currentDirectory/config
        set arrayOfSM($num.widget( [toplevel .$num]

        set arrayOfSM($num.xposition( [keyvalue::getvalue $num.xposition $fn]
        set arrayOfSM($num.yposition( [keyvalue::getvalue $num.yposition $fn]
        set arrayOfSM($num.width( [keyvalue::getvalue $num.width $fn]
        set arrayOfSM($num.height( [keyvalue::getvalue $num.height $fn]
        set arrayOfSM($num.top( [keyvalue::getvalue $num.top $fn]
        set arrayOfSM($num.color( [keyvalue::getvalue $num.color $fn]

        wm withdraw $arrayOfSM($num.widget(
        wm overrideredirect $arrayOfSM($num.widget( 1
        wm deiconify $arrayOfSM($num.widget(
        wm geometry $arrayOfSM($num.widget( =[set arrayOfSM($num.width(]x[set arrayOfSM($num.height(]+$arrayOfSM($num.xposition(+$arrayOfSM($num.yposition(

        frame $arrayOfSM($num.widget(.f1 -background gray
        image create photo menuImage -file $currentDirectory/images/menu.gif
        button $arrayOfSM($num.widget(.f1.menubutton -image menuImage
        label $arrayOfSM($num.widget(.f1.title -text "간단한 쪽지 #$num" -cursor diamond_cross
        image create photo newImage -file $currentDirectory/images/new.gif
        button $arrayOfSM($num.widget(.f1.newbutton -image newImage -command createNewMemo
        image create photo exitImage -file $currentDirectory/images/exit.gif
        button $arrayOfSM($num.widget(.f1.wastebutton -image exitImage
       
        pack $arrayOfSM($num.widget(.f1.menubutton -side left
        pack $arrayOfSM($num.widget(.f1.title -side left -fill x -expand true
        pack $arrayOfSM($num.widget(.f1.newbutton -side left
        pack $arrayOfSM($num.widget(.f1.wastebutton -side left

        text $arrayOfSM($num.widget(.memo -background #$arrayOfSM($num.color(

        pack $arrayOfSM($num.widget(.f1 -side top -fill x
        pack $arrayOfSM($num.widget(.memo -side top -fill both -expand true

        bind $arrayOfSM($num.widget(.f1.menubutton <ButtonRelease-1> {showMainMenu %W %X %Y}
        bind $arrayOfSM($num.widget(.f1.title <Button-1> {set prevX %x; set prevY %y}
        bind $arrayOfSM($num.widget(.f1.title <B1-Motion> {windowMove %x %y %W}
        bind $arrayOfSM($num.widget(.f1.title <ButtonRelease-1> {locationSave %W}
        bind $arrayOfSM($num.widget(.f1.wastebutton <ButtonRelease-1> {delmemo %W}
        bind $arrayOfSM($num.widget(.memo <KeyRelease> {memoSave %W}
        bind $arrayOfSM($num.widget(.memo <Button-3> {showMenu %W %X %Y}

        if {[file exists $currentDirectory/contents/$num.txt]} {
                set fd [open $currentDirectory/contents/$num.txt r]
                set content [read -nonewline $fd]
                close $fd
                $arrayOfSM($num.widget(.memo insert end $content
        }

        puts [topmost $num 1]
}

소스의 마지막 줄에 puts [topmost $num 1]이라는게 보일 겁니다.
이 부분이 실행되면, 콘솔에 Not a valid top window 라는 메시지가 뜨고, 항상 위 기능이 안됩니다.
그런데, 아래 소스 같은 경우 되거든요. 일단 메뉴에서...
.pm add check -label "항상 위" -command {alwaysOnTop $menuWidget} -variable aOTop
이렇게 하고... alwaysOnTop 함수는...

# 항상 위
proc alwaysOnTop {W} {
        global aOTop arrayOfSM currentDirectory

        set fn $currentDirectory/config
        set num [returnNUM $W]

        set arrayOfSM($num.top( $aOTop
        keyvalue&#58;&#58;putvalue $num.top $arrayOfSM($num.top( $fn
        topmost $num $aOTop
}

이 녀석은 됩니다. 위에서는 왜 안될까요?