zoukankan      html  css  js  c++  java
  • widget class in class

    ::iwidgets::panedwindow .pw

    class TimeWidget {
        inherit ::itk::Widget
        private common midhighlight #e0e0f0
        private common smallFont *-helvetica-bold-r-normal--34-*-*-*-*-*-*-*
        public method updateTime
        constructor {args} { 
           # the time widget
           itk_component add time {
           iwidgets::timefield $itk_interior.t \
            -relief flat -textbackground $midhighlight  \
                   -textfont $smallFont
           } {}
           eval itk_initialize $args
           bind $itk_interior <FocusIn> {focus . }
           pack $itk_component(time) -side right
           updateTime
        }
    }

    body TimeWidget::updateTime {} {
     #$itk_component(time) configure -state normal
     $itk_component(time) show
     #$itk_component(time) configure -state disabled
     after 950 [list $this updateTime]
    }

    class StatusBar {
     inherit ::itk::Widget

        private common midhighlight #e0e0f0
        private common smallFont *-helvetica-bold-r-normal--14-*-*-*-*-*-*-*

           constructor { args } {  
           itk_component add time {
           TimeWidget $itk_interior.t  
     } {}
      eval itk_initialize $args 
      grid $itk_component(time) -row 2 -column 2 -sticky w 
     }
    }

    set statusBar [StatusBar .sb]
    pack .pw -expand 1 -fill both
    pack $statusBar -expand 1 -fill x -side left

    ===================================================

    ::iwidgets::panedwindow .pw

    class TimeWidget {
        inherit ::itk::Widget
        private common midhighlight #e0e0f0
        private common smallFont *-helvetica-bold-r-normal--34-*-*-*-*-*-*-*
        public method updateTime
        constructor {args} { 
           # the time widget
           itk_component add time {
           iwidgets::timefield $itk_interior.t \
            -relief flat -textbackground $midhighlight  \
                   -textfont $smallFont
           } {}
           eval itk_initialize $args
           bind $itk_interior <FocusIn> {focus . }
           pack $itk_component(time) -side right
           updateTime
        }
    }

    body TimeWidget::updateTime {} {
     #$itk_component(time) configure -state normal
     $itk_component(time) show
     #$itk_component(time) configure -state disabled
     after 950 [list $this updateTime]
    }


    set timeWidget [TimeWidget .tb]
    pack .pw -expand 1 -fill both
    pack $timeWidget -expand 1 -fill x -side left

  • 相关阅读:
    算法:希尔排序(Shell Sort)
    算法:五步教你消除递归
    算法:排列算法
    算法:逆波兰表达式求值
    算法:中缀表达式转换为逆波兰表达式
    算法:优先级队列(PriorityQueue)
    Entityframework:“System.Data.Entity.Internal.AppConfig”的类型初始值设定项引发异常。
    算法:基于 RingBuffer 的 Deque 实现
    算法:基于 RingBuffer 的 Queue 实现《续》
    算法:基于 RingBuffer 的 Queue 实现
  • 原文地址:https://www.cnblogs.com/greencolor/p/2049410.html
Copyright © 2011-2022 走看看