Tk Library Source Code

Artifact [e83eaf05a9]
Login

Artifact e83eaf05a9ebd38065e1ae6e517a0458bc12d953:

Attachment "combofail.tcl" to ticket [1472763fff] added by nobody 2006-04-19 13:02:49.
   global applic
   global driverdata
   global runtaskset
   global nwframe bdframe gtbframe resframe bandata_top
   global notebook
   global nbframe
   
      if { [catch {package require BWidget} result] != 0 } {
         tk_messageBox -icon error -message "Can't find BWidget \n$result"
         exit
      }

   set applic(su) 1
   
#Notebook

   # MainFrame 
   set nbframe [MainFrame .nbframe]
   # NoteBook creation
   set notebook [NoteBook $nbframe.nb] ;# Only packed if pcgtp...

   if { $applic(su) == 1 } {
      # Frame for network
      set nwframe [$notebook insert end networkblad(1) -text "Branches"]
   }
   # Frames for trackdata and gtb-calculation
   set bdframe [$notebook insert end bandatablad(1) -text "Track"]
   set gtbframe [$notebook insert end gtbblad(1) -text "Run task"]
   set resframe [$notebook insert end resblad(1) -text "Result"]
   $notebook raise gtbblad(1)
   
   $notebook configure -height [expr [winfo screenheight .]*3/4]
   $notebook configure -width [expr [winfo screenwidth .]*6/7]
   pack $notebook -fill both -expand yes -padx 1 -pady 1
   
   pack $nbframe -fill both -expand yes ;# -padx 5 -pady 5





   set titleframeparams [TitleFrame $gtbframe.titleframeparams \
                   -bd 2 -relief groove\
                   -text "Parameters"\
                   -side center]

   set titf [frame [$titleframeparams getframe].titf]

   foreach kolname { adh adhformel otavst infsi accalg retalg sthmarg accutn retutn } {
      set lab [label ${titf}.l$kolname -text ""]
      set ent ""
      switch -- $kolname {
         adh {
            set runtaskset($kolname) "0.116"
            switch -- $applic(su) {
               1 { set ed 1; set bg "white" }
               0 { set ed 0; set bg grey }
               default { set ed 0; set bg grey }
            }
            set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg $bg -editable $ed \
                                             -command {showTrain none}]
         }
         adhformel {
            set runtaskset($kolname) "Cother"
            switch -- $applic(su) {
               1 {
                  set valus {"Cother" "Curtius-Kniffler" "JR1" "JR2" "JR-wet" "Nouvion"}
#                  set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg white \
#                                                   -editable 1 -command {showTrain none}]

                  #BWidget ComboBox does not work here...why??
                  set ent [ComboBox $titf.e$kolname -width 20 \
                           -textvariable runtaskset($kolname) \
                           -editable 0 \
                           -justify left \
                           -modifycmd {} \
                           -values $valus]
                           
                  
#                  set ent [iwidgets::combobox ${titf}.e$kolname -width 20 \
#                           -textvariable runtaskset($kolname) \
#                           -justify left \
#                           -selectioncommand {}]
#                  $ent insert list end "Cother" "Curtius-Kniffler" "JR1" "JR2" "JR-wet" "Nouvion"
               }
               0 {
                  set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg grey -editable 0]
               }
               default {
                  set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg grey -editable 0]
               }
            }
         }
         otavst {
            set runtaskset($kolname) "2700"
            #set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg grey -editable 0]
         }
         infsi {
            set runtaskset($kolname) "700"
            #set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg grey -editable 0]
         }
         accalg {
            set runtaskset($kolname) "v_list_l"
            #set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg grey -editable 0]
         }
         retalg {
            set runtaskset($kolname) "konst"
            #set ent [Entry ${titf}.e$kolname -width 20 -textvariable runtaskset($kolname) -bg grey -editable 0]
         }
         sthmarg {
            set driverdata($kolname) ""
            set ent [Entry ${titf}.e$kolname -width 20 -textvariable driverdata($kolname) -bg grey -editable 0] ;# Obs driverdata
         }
         accutn {
            set driverdata($kolname) ""
            set ent [Entry ${titf}.e$kolname -width 20 -textvariable driverdata($kolname) -bg grey -editable 0] ;# Obs driverdata
         }
         retutn {
            set driverdata($kolname) ""
            set ent [Entry ${titf}.e$kolname -width 20 -textvariable driverdata($kolname) -bg grey -editable 0] ;# Obs driverdata
         }
         default {}
      } ;# end switch
      
      if { $ent != "" } {
         if { [info exists butt] } {
            grid $lab $ent $butt -in $titf -sticky ew -pady 1 -padx 5 ;#-sticky news
            grid configure $butt -sticky {} -padx 5
         } else {
            grid ${titf}.l$kolname ${titf}.e$kolname -in $titf -sticky ew -pady 4 -padx 5 ;#-sticky news
         }
      }      
      catch { unset butt } ;# Sätts i switchen
   } ;# end foreach
   pack $titf -expand yes -fill both -pady 5 ;# -padx 5 

   pack $titleframeparams -side top -anchor w -expand yes -fill both -pady 3