#------------------------------------------------------------------------ # Compagny : 4Js # Developper : PM # Program : $PROJET/objects/entry.obj # Last modif. : 12.10.1995 # Title : Description des classes de base #------------------------------------------------------------------------ #====================================================================== # Entry ; # This class manages the use of the Tk-entry widget, and his # availability. In a form, it will be most used as part of the class # Field. #...................................................................... Class Entry { inherit TextWidget global Default public int_variable "" ;# ATTENTION !! can NOT be defined ;# with $name without KrackBoum!! public geo_width $Default(Entry,Width) public geo_relief $Default(Entry,Relief) public geo_expand 1 public geo_icursor end public geo_bg $Default(Entry,Bg) public geo_reverse_bg $Default(Entry,ReverseBg) public geo_active_bg $Default(Entry,ActiveBg) public geo_entry_active_bg $Default(Entry,ActiveBg) public geo_highlight_bg $Default(Entry,HighlightBg) public geo_selected_bg $Default(Entry,SelectedBg) public geo_selected_fg $Default(Entry,SelectedFg) public geo_selected_bw $Default(Entry,SelectedBw) #methodes: # set name(meth,init_resize) "Init_Resize_Entry $_name" constructor {config} { if { $int_variable == "" } { set int_variable ${this}_var } } #----------------------------------------------------------------------- # Destroy_Entry : # This function unsets the "internal" variables, used by the class # Field. Because the graphical widget is already destroyed by the class # Widget, it only necessary to unset things that only depend of Entry: # => its variable. #....................................................................... destructor { if { $int_variable != "" } { catch {unset $int_variable} } } #----------------------------------------------------------------------- # Refresh_Entry : # See general explication for the event, in $DOC/display.txt #....................................................................... method refresh { } { # puts "Entry::refresh; attributs for $this are : $geo_width $geo_relief $geo_borderwidth" $geo_widget configure \ -width $geo_width \ -bg $geo_bg \ -selectbackground $geo_selected_bg \ -fg $geo_fg \ -selectforeground $geo_selected_fg \ -selectborderwidth $geo_selected_bw \ -borderwidth $geo_borderwidth \ -relief $geo_relief \ -textvariable $int_variable } #----------------------------------------------------------------------- # Define_Entry : # Specific Tk-widget definition for this particular widget # See $DOC/define.txt #....................................................................... method define { } { # puts "Coming define the Entry $name" bind Entry {} set geo_widget [ \ entry $geo_root$int_name \ -width $geo_width \ -bg $geo_bg \ -fg $geo_fg \ -selectforeground $geo_selected_fg \ -selectborderwidth $geo_selected_bw \ -borderwidth $geo_borderwidth \ -relief $geo_relief \ -textvariable $int_variable ] if { $geo_widget != "" } { focus $geo_widget } } # -selectbackground $geo_selected_bg \ #----------------------------------------------------------------------- # Init_Resize_Entry : # This function raises or lowers the width of the entry # This is specially redefined for the entries because there is no # height attribut for them. The original function is defined with # the class Widget. # Parameters : # Return : nothing, only resize object. # Global variables used : curX, curY, # sim, som # Data changed : attribut geo_width of object #........................................................................ method init_resize { } { global Default global curX sim som set sim 0 set som 0 bind ${geo_widget} " set curX %X set sim 0 " bind ${geo_widget} " set X \[expr ( %X - \$curX ) \] # puts \"Init_Raise_Entry: X= >\$X<\" incr sim \$X if { \$sim > $Default(Desi,EWD) || \$sim < -$Default(Desi,EWD) } { set som \[expr \$sim / $Default(Desi,EWD) \] $this config -geo_width \[expr \[ $this getPub -geo_width \] + \$som \] set sim \[expr \$sim %% $Default(Desi,EWD) \] } set curX %X $this refresh ;# horrible, but tk " bind ${geo_widget} "" # if { \[set ${_name}(int,show_attr)\] == \"H\" } { # global \[set ${_name}(int,parent)\] # puts \"Init_Raise_Entry: Button Release \" # call \[set ${_name}(int,parent)\] set_width \[set ${_name}(geo,width)\] # } } } ;# end of class # ======================================================================