# ------------------------------------------------------------ # Copyright (c) 2014 - 2016 # Q.W.Page Associates Inc. # www.qwpage.com # All rights reserved. # ------------------------------------------------------------ /* { todo - date dialog - default to no resize - minimize button doesn't do anything Some guidelines/rules If a method ends with "_setup" you can override but don't call. If a method begins with "entry_", you can call from the outside. Probably not a good idea to override the main method, but you can. Creates a date entry widget using techniques from Flynt page 517. Options: .default yyyymmdd Originally positions on this date. If not supplied positions on system date. If supplied but empty, positions on empty. .date_format ddmonthyyyy This is how the date is displayed. Any qw date format can be used. Default is ddmonthyyyy. .date_entry_format scan or ddmmyyyy ddmmyyyy is the default .width 99 Number of characters wide. Default is 15. .pick_button_image Defaulted to a little calendar image .font {} .labelframe_text "The label Title" Default is empty. .pick_button_enabled 1 */ } # ------------------------------------------------------------ # ::qw::entry3::archetype_entry # ------------------------------------------------------------ ::itcl::class ::qw::entry3::archetype { protected variable _sargs ""; protected variable _tk_path ""; protected variable _window ""; protected variable _database ""; protected variable _database_id ""; protected variable _database_path ""; protected variable _database_type ""; protected variable _user ""; protected variable _username ""; protected variable _entry_value ""; protected variable _entry_before ""; protected variable _default_entry_textvariable ""; protected variable _entry_textvariable_name ""; protected variable _mru_list ""; /* { Modes ----- callback The value is always the formatted value. This pertains to the .value, the before value, and textvariable. default The textvariable is formatted but the _entry_value and _before_value are raw. Database fields --------------- The database fields exist so that the entry can use a user's settings, in some cases, for default format and scan specifications. If the database is not supplied then each widget has it's own default or the caller has supplied the default. _entry_value The raw field value such as 20151231 for a date, or 123.45 for a number. It is the value supplied in .value in the constructor and in the edit_set and returned by edit_get. _entry_before The last raw field value, used to restore the field when is pressed. _default_entry_textvariable_name The name supplied in .textvariable, or is .textvariable is empty, we set this to _default_entry_textvariable. In the documentation we simply refer to _entry_textvariable meaning the current value of the tk entry widget. _default_entry_textvariable This variable is only used internally. The textvariable can be specified by the user but if it isn't, we use this local member variable internally. This keeps the code simpler than managing the entry widget values two entirely different ways, i.e. by value and by textvariable. _mru_list We keep this updated whenever a new value is scanned, and the user can get it using mru_list_get. The _mru_list starts out as ._mru_list. */ } constructor {} { #::qw::entry3::archetype /* { We are limited in what we can do in the constructor because the constructor does not respect polymorphism. When the base constructor calls foo it gets its own foo even if a derived class has overridden foo. */ } ::set rwb1_debug 0; ::set _tk_path [::string map [::list "::" {}] $this]; ::if {$rwb1_debug} {::puts "rwb1_debug,::qw::entry3::constructor,1000.1,this==$this,_tk_path==$_tk_path";} ::if {[::string index $_tk_path 0] ne "."} { ::qw::throw "[::qw::method_name] - invalid .tk_path \"$_tk_path\"."; } } method main {sargs} { #::qw::entry3::archetype # mode_setup; ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.0,sargs==\n[::sargs::format $sargs]";} sargs_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.1,_sargs==\n[::sargs::format $_sargs]";} ::sargs::var::+= _sargs $sargs; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.2";} user_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.3";} textvariable_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.4";} labelframe_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.5";} label_widget_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.5a";} cell_widget_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.6";} pick_button_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.6a";} value_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.7";} bindings_setup; ::if {$rwb1_debug} {::puts "rwb1_debug,main,1000.8,_entry_textvariable_name==$_entry_textvariable_name";} ::set _mru_list [::sargs::get $_sargs .mru_list]; #nv2.34.0 (go_find_compare) # ::puts "pgq,debug666::qw::entry3::archetype main _mru_list==$_mru_list"; #::qw::stack_dump; ;#//pgq,debug } method sargs_setup {} { #::qw::entry3::archetype /* { We keep our option _sargs. Here we return our default options and this method can be overridden and enhanced. Returns the structure containing the default options for the widget. Each derived entry widget will likely override and add options by chaining first and altering the result. */ } # ::set bg white; # ::set bg gray91; # .background1 $bg ::sargs::var::+= _sargs [::sargs \ .label.is_enabled 0 \ .label.width 15 \ .label.text "" \ .label.font {-family helvetica -size 12 -weight normal} \ .entry.width 15 \ .entry.font {-family helvetica -size 12 -weight normal} \ .labelframe.text "" \ .labelframe.is_enabled 0 \ .labelframe.width {-family helvetica -size 12 -weight normal} \ .pick_button.is_enabled 0 \ .pick_button.image "" \ .mru_list [::list] \ .value "" \ ]; #_pgq,debug2320 #::sargs::var::set _sargs .entry.width 115; ;#// this worked, but it established a larger minimum_width } method user_setup {} { #::qw::entry3::archetype /* { If there is a database and corresponding user, we get several relevant field here for convenience, including the user and username. */ } ::set _database [::sargs::get $_sargs .database]; ::if {$_database eq ""} { ::set _window [::sargs::get $_sargs .odb.object]; ::if {$_window ne ""} { ::set _database [$_window odb_database application]; } } ::if {[::qw::command_exists $_database]} { /* { If we have a database, set up some useful database-related variables. If it's an application database we probably have a user, and the user might have format options we can use. */ } ::set _database_path [$_database cpp_database_path]; ::set _database_id [$_database cpp_database_id]; ::set _database_type [$_database cpp_database_type]; ::if {$_database_type eq "application"} { ::set _user [$_database cpp_user_get]; ::if {$_user ne ""} { ::set _username [[$_user .name] odb_get]; } } } } method textvariable_setup {} { #::qw::entry3::archetype /* { We determine whether a textvariable was supplied or not. If not, then we use a member variable as the textvariable. By always using a textvariable, even if caller did not specify one, we simplify the code. */ } ::if {[::sargs::get $_sargs .textvariable] ne ""} { ::set _entry_textvariable_name [::sargs::get $_sargs .textvariable]; } else { ::set _entry_textvariable_name [::itcl::scope _default_entry_textvariable]; ::if {[::sargs::exists _sargs .value]} { ::set $_entry_textvariable_name [::sargs::get $_sargs .value]; } } } method labelframe_setup {} { #::qw::entry3::archetype /* { We set the labelframe's text if it is enabled. Otherwise we remove the labeltext border by setting it's relief to flat. */ } ::if {[::sargs::boolean_get $_sargs .labelframe.is_enabled]} { ::set Title [::sargs::get $_sargs .labelframe.text] $_tk_path.labelframe configure -text $Title -borderwidth 0; #-ipadx and -ipady } else { #-background $_tk_path.labelframe configure -relief flat -borderwidth 0 -background [::sargs::get $_sargs .background]; } } method label_widget_setup {} { #::qw::entry3::archetype /* { */ } ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,archetype,label_widget_setup,1000.0";} ::if {![::qw::command_exists $_tk_path.label]} { /* { If cell already exists we don't create it. This allows derived entry widgets to override the cell. */ } #-background ::if {[::sargs::boolean_get $_sargs .label.is_enabled]} { ::ttk::label $_tk_path.label \ -font [::sargs::get $_sargs .label.font] \ -width [::sargs::integer_get $_sargs .label.width] \ -text [::sargs::get $_sargs .label.text] \ -anchor e \ -background [::sargs::get $_sargs .background] \ ; ::if {$rwb1_debug} {::puts "rwb1_debug,archetype,label_widget_setup,1000.1";} # ::pack $_tk_path.label -side left -expand 1 -padx 4; ::pack $_tk_path.label -side left -padx 4; ::if {$rwb1_debug} {::puts "rwb1_debug,archetype,label_widget_setup,1000.2";} } } } method cell_widget_setup {} { #::qw::entry3::archetype /* { We create the actual entry widget which we refer to as the cell for convenience. We check to see if it exists first as a derived class could override this method and use a difference entry widget for the cell */ } ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,archetype,cell_widget_setup,1000.0";} ::if {![::qw::command_exists $_tk_path.entry]} { /* { If cell already exists we don't create it. This allows derived entry widgets to override the cell. */ } #nv2.32.0 ::ttk::entry $_tk_path.entry \ -state normal \ -font [::sargs::get $_sargs .entry.font] \ -width [::sargs::integer_get $_sargs .entry.width] \ -textvariable $_entry_textvariable_name \ -validate all \ -validatecommand [::list $_tk_path edit_validate \ .action_type {%d} \ .char_index {%i} \ .value_new {%P} \ .value_current {%s} \ .value_insert_delete {%S} \ .validate_option {%v} \ .validate_condition {%V} \ .widget {%W} \ ] \ -invalidcommand [::list $_tk_path edit_throw] \ ; ::if {$rwb1_debug} {::puts "rwb1_debug,archetype,cell_widget_setup,1000.1";} ::pack $_tk_path.entry -side left -expand 1 -fill x -padx 4; ::if {$rwb1_debug} {::puts "rwb1_debug,archetype,cell_widget_setup,1000.2";} } } method mru_list_get {} { ::return $_mru_list; } method value_setup {} { #::qw::entry3::archetype ::if {[::sargs::get $_sargs .textvariable] eq ""} { ::set RawValue [::sargs::get $_sargs .value]; ::set _entry_before $RawValue; ::set _entry_value $RawValue; ::set $_entry_textvariable_name [edit_format]; } else { edit_check; } } method pick_button_setup {} { #::qw::entry3::archetype # -------------------------------------------------------- # pick_button_setup # -------------------------------------------------------- ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,pick_button_setup,1000.0";} ::if {$rwb1_debug} {::puts "rwb1_debug,pick_button_setup,1000.1";} ::if {[::sargs::get $_sargs .pick_button.image] eq ""} { #::sargs::var::set _sargs .pick_button_image [Bitmap::get file]; ::set Image [::image create photo down_arrow -format GIF -file [::file join $::qw_library system images down_grey.gif]]; #::set Image [Bitmap::get file]; ::sargs::var::set _sargs .pick_button.image $Image; } ::ttk::button $_tk_path.pick_button \ -image [::sargs::get $_sargs .pick_button.image] \ -command [::list $_tk_path edit_pick] \ -takefocus 0 \ ; ::if {$rwb1_debug} {::puts "rwb1_debug,pick_button_setup,1000.2";} ::if {[::sargs::boolean_get $_sargs .pick_button.is_enabled]} { ::pack $_tk_path.pick_button -side right -padx 4; } ::if {$rwb1_debug} {::puts "rwb1_debug,pick_button_setup,1000.3";} } method focus_next {} { #//::puts "pgq,debug::qw::entry3::archetype focus_next enter _tk_path==$_tk_path"; ::focus [tk_focusNext $_tk_path.entry]; } method focus_prev {} { #//::puts "pgq,debug::qw::entry3::archetype focus_next enter _tk_path==$_tk_path"; ::focus [tk_focusPrev $_tk_path.entry]; } method bindings_setup {} { #::qw::entry3::archetype ::bind $_tk_path.entry [::itcl::code $this edit_pick]; ::bind $_tk_path.entry [::itcl::code $this edit_pick]; ::bind $_tk_path [::list ::itcl::delete object $_tk_path]; ::if {[::winfo exists $_tk_path.pick_button]} { ::bind $_tk_path.pick_button [::itcl::code $this edit_pick]; } ::bind $_tk_path.entry "[::itcl::code $this focus_prev];::break"; ::bind $_tk_path.entry [::itcl::code $this focus_next]; ::bind $_tk_path.entry [::itcl::code $this focus_prev]; ::bind $_tk_path.entry [::itcl::code $this focus_next]; ::bind $_tk_path.entry [::itcl::code $this focus_next]; /* { Added the break to binding so that the dismiss button would not be invoked. */ } ::bind $_tk_path.entry "[::itcl::code $this edit_restore];::break;"; } method value_get {} { #::qw::entry3::archetype /* { The outside world wants the value now, but it could be in the process of being edited. We call edit_check. If the entry is not being edited then it's value will be fine and nothing happens. If it is being edited then an error could be processed. The error has already been handled so we simply throw a priority ignore error. */ } ::set rwb1_debug 0; ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::return $_entry_value; } method value_set {sargs} { #::qw::entry3::archetype /* { Not implemented yet. */ } #nv2.34.0 (go_find_compare) # ::puts "pgq,debug666::qw::entry3::archetype value_set sargs==(\n[::sargs::format .structure $sargs]\n)"; ::set rwb1_debug 0 ::set Value [::sargs::get $_sargs .value]; ::set _entry_value $Value; ::set _entry_before $Value; # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype value_set BEFORE promote Mru==$Mru";} ::qw::list::var::promote .list _mru_list .element $Value; # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype value_set AFTER promote Mru==$Mru";} ::set $_entry_textvariable_name [edit_format]; # ::set _date_formatted [::qw::date::format .date $_date .format [::sargs::get $_sargs .date_display_format]]; ::if {$rwb1_debug} {::puts "rwb1_debug,command_proc,1000.6";} ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::if {$rwb1_debug} {::puts "rwb1_debug,command_proc,1000.8";} ::return $_entry_value; } method cell_value_get {} { #::qw::entry3::archetype /* { The outside world wants the value now, but it could be in the process of being edited. We call edit_check. If the entry is not being edited then it's value will be fine and nothing happens. If it is being edited then an error could be processed. The error has already been handled so we simply throw a priority ignore error. */ } ::set rwb1_debug 0; ::return [$_tk_path.entry get]; } method cell_value_set {sargs} { #::qw::entry3::archetype /* { Not implemented yet. */ } #nv2.34.0 (go_find_compare) # ::puts "pgq,debug666::qw::entry3::archetype cell_value_set sargs==(\n[::sargs::format .structure $sargs]\n)"; ::set Value [::sargs::get $sargs .value]; ::set $_entry_variable_name $Value; ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::return ""; } method edit_format {} { #::qw::entry3::archetype /* { Converts raw value to formatted value that is displayed in the cell. The root method just returns the raw value. Other classes will override. */ } ::return $_entry_value; } method edit_scan {} { #::qw::entry3::archetype /* { Convert the cell value from it's formatted form to it's raw value. Throws an exception if there are any problems. This archetype method just returns the cell value without scanning anything. */ } ::return [::set $_entry_textvariable_name]; } method edit_check {} { #::qw::entry3::archetype # ::puts "pgq,debug666...::qw::entry3::archetype edit_check enter"; #::qw::stack_dump; ;#//pgq,debug /* { Scans the cell to check validity. Returns 1 if ok and 0 otherwise. Calls edit_scan to perform the check. Used by the focusout validation check and also by value_get before we return the value. If not valid, this method puts up the error message, clears the selection, and puts focus back on the cell. Then it throws an exception with .priority ignore to unwind the stack. We do not let the error get handled by bgerror. The reason is that we want the focus put back in the entry widget and this has to be done after the error message is dismissed because the error dialog takes the focus when it is up. */ } ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.0";} ::set Cell $_tk_path.entry; $Cell selection clear; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.1";} ::qw::try { ::set After [edit_scan]; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.2";} } catch Exception { ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.3";} edit_error [::qw::exception::nest \ .super [::sargs .text "Invalid value \"[::set $_entry_textvariable_name]\"."] \ .sub $Exception \ ]; ::return 0 } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.4";} ::set _entry_value $After; ::set _entry_before $After; ::set $_entry_textvariable_name [edit_format]; #nv2.34.0 (go_find_compare) # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype edit_check BEFORE promote After==$After Mru==$Mru";} ::qw::list::var::promote .list _mru_list .element $After; # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype edit_check AFTER promote Mru==$Mru";} ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.5";} ::return 1; } method edit_validate {sargs} { #::qw::entry3::archetype /* { This method is invoked on every possible operation be the cell (tk entry) widget but we are mainly interested in focusin and focusout. Derived callses can override to process additional operations occurring in the cell. */ } ::set rwb1_debug 0; ::set Cell $_tk_path.entry; ::switch -- [::sargs::get $sargs .validate_condition] { focusin { /* { When we receive focus we select everything, turning the cell blue. */ } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.3";} $Cell selection range 0 end; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.4";} } focusout { #nv2.28.4 () - column_fill.qw_script - >Tools >Manipulate Column - tbf changed ::if to include ne .qw_dialog_1 - changed edit_check to ::if !edit_check ::focus Cell # ::if {[::focus] ne "" && [::focus] ne ".qw_dialog_1"} {} ::if {[::focus] ne "" && ![::string match ".qw_dialog_*" [::focus]]} { /* { The focus reports the widget we are going to. If it returns empty then we are going outside our application and in that case we don't want to check. The user should be able to leave and come back without interference. It works. */ } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.5";} ::if {![edit_check]} { ::focus $Cell; }; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.6";} } } } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.7";} ::return 1; } method edit_pick {} { #::qw::entry3::archetype ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.0";} ::if {![edit_check]} { ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.1";} ::return; } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.3";} ::set Cell $_tk_path.entry; ::set Default [::set $_entry_textvariable_name]; #nv2.34.0 (go_find_compare) # ::puts "pgq,debug666::qw::entry3::archetype edit_pick Cell==$Cell _entry_textvariable_name==$_entry_textvariable_name Default==$Default"; ::if {$Default eq ""} { ::sargs::var::set sargs .default [::lindex [::sargs::get $_sargs .list] 0]; } # ::puts "pgq,debug666::qw::entry3::archetype edit_pick Cell==$Cell _entry_textvariable_name==$_entry_textvariable_name Default==$Default"; # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype edit_pick BEFORE pick Mru==$Mru";} ::set ResultStructure [::qw::dialog85::mru_list \ .title [::sargs::get $_sargs .label.text] \ .browse_type "" \ .mru_list $_mru_list \ .bbox [::qw::winutil::bbox_from_widget .widget $_tk_path.entry] \ .width [::sargs::get $_sargs .width] \ ]; /* { Note that we update the _mru_list whether anything was selected or not when we popped up the mru_list dialog. */ } ::set _mru_list [::sargs::get $ResultStructure .mru_list]; # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype edit_pick AFTER pick BEFORE promote Mru==$Mru";} ::set Result [::sargs::get $ResultStructure .result]; ::qw::list::var::promote .list _mru_list .element $Result; # ::foreach Mru $_mru_list {::puts "pgq,debug666::qw::entry3::archetype edit_pick AFTER promote Mru==$Mru";} ::if {$Result ne ""} { /* { If a value was selected update the current and before values. we also update the mru_list. will do nothing now. */ } ::set $_entry_textvariable_name $Result; ::set _entry_value_before $Result; } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.6";} } method edit_restore {sargs} { #::qw::entry3::archetype /* { Typically invoked by but can also be called from the outside. */ } ::set rwb1_debug 0; ::set _entry_value $_entry_before; ::set $_entry_textvariable_name [edit_format]; $_tk_path.entry selection range 0 end; } method edit_error {Error} { ::return [::bgerror $Error]; } } ::proc ::qw::entry3::create_helper {sargs} { /* { Ordinary widgets need a tk path as their parent and then the inner widgets have preset names. Dialogs do not need a parent but in the interest of keeping things general we will allow a .parent sargs field, in which case we will create a frame and place it within the parent. (1) Create a frame or labelframe using $TkPath or generated name (2) Rename the command to $TkPath.labelframe We intend to reuse it's command name. Note that renaming it changed the command name but not the widget path. It's widget path is still $TkPath and we will reuse it's command. (3) Call the main method and return it's result. (4) Return the $TkPath; */ } ::set TkPath [::sargs::get $sargs .tkpath]; ::set PromptClass [::sargs::get $sargs .prompt_class]; ::if {[::sargs::boolean_get $sargs .labelframe.is_enabled]} { ::ttk::labelframe $TkPath; } else { ::frame $TkPath; } ::uplevel #0 ::rename $TkPath $TkPath.labelframe; ::set Entry [$PromptClass ::$TkPath]; $Entry main $sargs; #//::puts "pgq,debug::qw::entry3::create_helper Entry==$Entry sargs==(\n[::sargs::format .structure $sargs]\n)"; #//::puts "pgq,debug::qw::entry3::create_helper Entry==$Entry ::return TkPath==$TkPath"; #//::puts "pgq,debug::qw::entry3::create_helper Entry==$Entry"; ::return $TkPath; } # ------------------------------------------------------------ # ::qw::entry3::plain # ------------------------------------------------------------ ::proc ::qw::entry3::plain {TkPath sargs} { ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::plain1] } ::itcl::class ::qw::entry3::plain1 { inherit ::qw::entry3::archetype; } # ------------------------------------------------------------ # ::qw::entry3::qw_settings_entry # ------------------------------------------------------------ ::proc ::qw::entry3::qw_settings_entry {TkPath sargs} { /* { This entry widget was design for calling back to the new settings widgets. */ } ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::qw_settings_entry1]; } ::itcl::class ::qw::entry3::qw_settings_entry1 { inherit ::qw::entry3::archetype; protected variable _needs_refresh 0; protected variable _entry_is_dirty 0; protected variable _callback_count 0; protected variable _idle_id_refresh ""; #nv2.30.0 protected variable _nv_window ""; protected variable _nv_field ""; #nv2.30.3g protected variable _entry_is_committing 0; #nv2.32.0 protected variable _exception ""; protected variable _idle_id_edit_throw ""; method destructor {} { # #//::puts "pgq,debug::qw::entry3::qw_settings_entry destructor enter _idle_id_refresh==$_idle_id_refresh"; ::if {$_idle_id_refresh ne ""} { ::after cancel $_idle_id_refresh; #::qw::after cancel $_idle_id_nv_toplevel_withdraw; ::set _idle_id_refresh ""; } #nv2.32.0 ::if {$_idle_id_edit_throw ne ""} { ::after cancel $_idle_id_edit_throw; ::set _idle_id_edit_throw ""; } } #nv2.30.3 (bug fix) - we must avoid ::bgerror method edit_error {Error} { #::return [::bgerror $Error]; focusIn $_tk_path.entry; ::qw::throw $Error; } /* { active_cell_make_dirty; [tkPath] set [activeCell] [::qw::date::format $Result "%d %b %Y"]; active_cell_commit; [tkPath] clear cache active; [tkPath] activate [activeCell]; ;#// Without this, our cell is not yellow (on NOTES tables) and the table looks dead... method entry_make_dirty {sargs} { #// if present execute the change_before callback (it may throw an exception) #// mark entry widget dirty } method entry_qw_set {sargs} { #// low level set of entry value } #method entry_commit {sargs} {} method entry_commit {} { #// execute the set callback } method entry_clear_cache {sargs} { #// schedule for after idle the get callback } method entry_activate {} { #// "activate" entry - give focus and "highlight" } */ } method main {sargs} { #::qw::entry3::qw_settings_entry #nv2.23.0 - added _nv_window - added method focusIn - changed ::focus to call focusIn #//::puts "pgq,debug...qw_settings_entry main enter sargs==(\n[::sargs::format .structure $sargs]\n)"; ::set _nv_window [::sargs::get $sargs .qw_settings_nv_window]; ::set _nv_field [::sargs::get $sargs .qw_settings_nv_field]; ;#// not used... yet #//::puts "pgq,debug...qw_settings_entry main _nv_window==[$_nv_window odb_path] _nv_field==$_nv_field"; ::return [chain $sargs]; } method focusIn {tkPath} { #::qw::entry3::qw_settings_entry ::if {[::winfo exists $tkPath]} { ::focus $tkPath; } ::if {[::qw::command_exists $_nv_window]} { #$_nv_window activeEntryFocusIn $tkPath; $_nv_window activeEntryFocusIn [::sargs .ewidget $this .tkPath $tkPath .field_path $_nv_field]; } } method focus_next {} { #::qw::widget1::qw_settings_entry entry_commit; ::set MaybeFocus [tk_focusNext $_tk_path.entry]; #//::puts "pgq,debug::qw::entry3::qw_settings_entry focus_next enter MaybeFocus==$MaybeFocus"; ::if {$MaybeFocus ne ""&&[::winfo class $MaybeFocus] eq "TEntry"} { ::focus [tk_focusNext $_tk_path.entry]; ::if {[::qw::command_exists $_nv_window]} { $_nv_window activeEntryFocusIn [::sargs .ewidget $this .tkPath [::focus] .field_path $_nv_field]; } } } method focus_prev {} { #::qw::widget1::qw_settings_entry entry_commit; ::set MaybeFocus [tk_focusPrev $_tk_path.entry]; #//::puts "pgq,debug::qw::entry3::qw_settings_entry focus_prev enter MaybeFocus==$MaybeFocus"; ::if {$MaybeFocus ne ""&&[::winfo class $MaybeFocus] eq "TEntry"} { ::focus [tk_focusPrev $_tk_path.entry]; ::if {[::qw::command_exists $_nv_window]} { $_nv_window activeEntryFocusIn [::sargs .ewidget $this .tkPath [::focus] .field_path $_nv_field]; } } } method entry_is_dirty {} { #::qw::widget1::qw_settings_entry ::return $_entry_is_dirty; } method entry_make_dirty {} { #//::puts "pgq,debug232::qw::entry3::qw_settings_entry entry_make_dirty enter _entry_is_dirty==$_entry_is_dirty"; #::qw::stack_dump; ;#//pgq,debug232c ::if {$_entry_is_dirty} { ::return; } ::set Callback [::sargs::get $_sargs .qw_settings_change_before_callback]; #//::puts "pgq,debug232c::qw::entry3::qw_settings_entry entry_make_dirty Callback==$Callback"; ::if {$Callback ne ""} { ::set Command [::lindex $Callback 0]; ::if {![::qw::command_exists $Command]} { ::qw::bug 314120151007114003 "[::qw::methodname] - qw_settings_change_before_callback command \"$Command\" does not exist."; } ::qw::try { ::incr _callback_count 1; ::qw::finally [::itcl::code $this callback_completed]; ::lappend Callback .tk_path $_tk_path; ::set After [::uplevel #0 $Callback]; } catch Exception { #_pgq,debug230-1 - what the fuck is ::bgerror - changing to ::qw::throw fixed click away error msg and prompt dismiss - broke arrow up, switch back fixed #edit_error $Exception; ;#// calls ::bgerror #nv2.30.0 - added next line focusIn $_tk_path.entry; #nv2.32.0 #$_tk_path.entry configure -validate all; ;#// no help, too soon #//::puts "pgq,debug232c::qw::entry3::qw_settings_entry entry_make_dirty catch Exception - after focusIn and about to rethrow"; #::qw::throw $Exception; ::set _exception $Exception; ::return; } } #//::puts "pgq,debug232c::qw::entry3::qw_settings_entry entry_make_dirty ::set _entry_is_dirty 1"; ::set _entry_is_dirty 1; } method entry_clear_cache {} { #::qw::entry3::qw_settings_entry #//::puts "pgq,debug2303g::qw::entry3::qw_settings_entry entry_clear_cache _entry_is_dirty==$_entry_is_dirty _needs_refresh==$_needs_refresh _idle_id_refresh==$_idle_id_refresh tk_path==$_tk_path"; #::qw::stack_dump; ;#//pgq,debug2303 ::if {!$_needs_refresh} { #::after idle [::itcl::code $this refresh]; #nv2.30.3 (bug fix) - leaking _idle_id_refresh - ??? ::if {$_idle_id_refresh ne ""} { #//::puts "pgq,debug2303g::qw::entry3::qw_settings_entry entry_clear_cache CANCEL _idle_id_refresh==$_idle_id_refresh"; ::after cancel $_idle_id_refresh; } ::set _idle_id_refresh [::after idle [::itcl::code $this refresh]]; #//::puts "pgq,debug2303g::qw::entry3::qw_settings_entry entry_clear_cache NEW _idle_id_refresh==$_idle_id_refresh"; ::set _needs_refresh 1; } } method callback_completed {} { #::qw::entry3::qw_settings_entry #//::puts "pgq,debug232c::qw::entry3::qw_settings_entry callback_completed enter _callback_count==$_callback_count"; ::if {$_callback_count!=1} { #_pgq,debug230-1 #::qw::bug 314120151007111507 "Invalid _callback_count \"$_callback_count\"."; ::set _callback_count 1; } ::incr _callback_count -1; } method refresh {} { #::qw::entry3::qw_settings_entry #//::puts "pgq,debug2303g::qw::entry3::qw_settings_entry refresh enter _callback_count==$_callback_count _entry_is_dirty==$_entry_is_dirty _needs_refresh==$_needs_refresh _idle_id_refresh==$_idle_id_refresh tk_path==$_tk_path"; #//::puts "pgq,debug2303::qw::entry3::qw_settings_entry refresh enter _entry_is_dirty==$_entry_is_dirty _needs_refresh==$_needs_refresh _idle_id_refresh==$_idle_id_refresh tk_path==$_tk_path"; #//::puts "pgq,debug::qw::entry3::qw_settings_entry refresh enter _entry_is_committing==$_entry_is_committing _entry_is_dirty==$_entry_is_dirty _needs_refresh==$_needs_refresh _idle_id_refresh==$_idle_id_refresh tk_path==$_tk_path"; ::if {$_callback_count} { ::return; } #nv2.30.3 (bug fix) - ::qw::entry3::qw_settings_entry method refresh {} executing on _entry_is_dirty cell #nv2.30.3g ::if {1 \ &&$_entry_is_dirty \ } { #//::puts "pgq,debug2303g::qw::entry3::qw_settings_entry refresh enter _entry_is_dirty==$_entry_is_dirty _entry_is_committing==$_entry_is_committing"; #::if {!$_entry_is_committing} {} ::set _needs_refresh 0; ::set _idle_id_refresh ""; ::return; #{} } ::set Callback [::sargs::get $_sargs .qw_settings_get_callback]; ::set Command [::lindex $Callback 0]; ::if {![::qw::command_exists $Command]} { ::qw::bug 314120151007110834 "[::qw::methodname] - qw_settings_get_callback command \"$Command\" does not exist."; } ::qw::try { ::incr _callback_count 1; ::qw::finally [::itcl::code $this callback_completed]; ::lappend Callback .tk_path $_tk_path; ::set After [::uplevel #0 $Callback]; } catch Exception { edit_error $Exception; ::return; } #_pgq,debug230-1 - why don't we ::set _entry_is_dirty 0; ::set $_entry_textvariable_name $After; ::set _entry_before $After; #- we can't do this - e.g. just try up and down arrows on a table of accounts with the address tab visible - seizing focus in the companion pane is a killer /* { ::focus $_tk_path.entry; $_tk_path.entry selection clear; $_tk_path.entry icursor end; */} ::set _needs_refresh 0; #nv2.30.3 (bug fix) - PGQ,DEBUG - ??? - ::qw::entry3::qw_settings_entry method refresh {} not setting _idle_id_refresh "" ::set _idle_id_refresh ""; } method entry_qw_set {sargs} { #// low level set of entry value ::set After [::sargs::get $sargs .after]; ::set $_entry_textvariable_name $After; #::set _entry_before $After; #::focus $_tk_path.entry; #$_tk_path.entry selection clear; #$_tk_path.entry icursor end; } method entry_commit {} { #::qw::entry3::qw_settings_entry #// execute the set callback #//::puts "pgq,debug232c::qw_settings_entry entry_commit enter tk_path==$_tk_path _entry_is_dirty==$_entry_is_dirty s_args==(\n[::sargs::format .structure $_sargs]\n)"; #::qw::stack_dump; ;#//pgq,debug2303 #_pgq,debug230-1 #::if {[$_nv_window idle_id_nv_toplevel_withdraw] eq ""} { # ::return; #} ::if {!$_entry_is_dirty} { ::return; } ::set Callback [::sargs::get $_sargs .qw_settings_set_callback]; ::set Command [::lindex $Callback 0]; ::if {![::qw::command_exists $Command]} { ::qw::bug 314120151007120507 "[::qw::methodname] - qw_settings_set_callback command \"$Command\" does not exist."; } ::qw::try { #nv2.30.3g #::set _entry_is_committing 1; ::incr _callback_count 1; ::qw::finally [::itcl::code $this callback_completed]; ::lappend Callback .tk_path $_tk_path; #nv2.30.3g #::set _entry_is_dirty 0; ::set Result [::uplevel #0 $Callback]; } catch Exception { #_pgq,debug230-1 - what the fuck is ::bgerror - changing to ::qw::throw fixed click away error msg and prompt dismiss - broke arrow up, switch back fixed #edit_error $Exception; ;#// calls ::bgerror #nv2.30.0 - added next line #//::puts "pgq,debug2303f...::qw_settings_entry entry_commit Exception calling focusIn $_tk_path.entry"; focusIn $_tk_path.entry; #entry_activate; #nv2.30.3g #::set _entry_is_committing 0; #nv2.30.3g #::set _entry_is_dirty 1; ::qw::throw $Exception; } #//::puts "pgq,debug2303...::qw_settings_entry entry_commit ::set _entry_is_dirty 0"; ::set _entry_is_dirty 0; #nv2.30.3g #::set _entry_is_committing 0; #nv2.30.3 (bug fix) - PGQ,DEBUG - change justify "right" to "rightfuck" - database is okay but display lags behind until dismiss/re-launch entry_clear_cache; } method entry_activate {} { #::qw::entry3::qw_settings_entry #// "activate" entry - give focus and "highlight" #//::puts "pgq,debug2303f...qw_settings_entry entry_activate _tk_path==$_tk_path _entry_is_dirty==$_entry_is_dirty ::focus==[::focus]"; #::qw::stack_dump; ;#//pgq,debug2303f focusIn $_tk_path.entry; #//::puts "pgq,debug2303f...qw_settings_entry entry_activate _tk_path==$_tk_path _entry_is_dirty==$_entry_is_dirty ::focus==[::focus]"; $_tk_path.entry selection range 0 end; $_tk_path.entry icursor end; } method sargs_setup {} { #::qw::entry3::qw_settings_entry /* { We keep our option _sargs. Here we return our default options and this method can be overridden and enhanced. Returns the structure containing the default options for the widget. Each derived entry widget will likely override and add options by chaining first and altering the result. */ } ::return [chain]; } method user_setup {} { #::qw::entry3::qw_settings_entry /* { The archetype loads the _database and the _user so that default formats are available. In the qw_settings_entry the callbacks do all of the formatting so we really don't need to chain. On the other hand, it doesn't do any harm either. */ } ::return [chain]; } method textvariable_setup {} { #::qw::entry3::qw_settings_entry ::return [chain]; } method labelframe_setup {} { #::qw::entry3::qw_settings_entry ::return [chain]; } method label_widget_setup {} { #::qw::entry3::qw_settings_entry /* { */ } ::return [chain]; } method cell_widget_setup {} { #::qw::entry3::qw_settings_entry ::return [chain]; } method value_setup {} { ::set rwb1_debug 0; ::if {[::sargs::get $_sargs .textvariable] eq ""} { /* { A textvariable was not supplied so get the supplied value (or it could have been set by default). */ } ::qw::bug 314120151005141251 "[::qw::methodname] - no .textvariable argument."; } ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,value_setup,1000.0";} /* { The value is already in the textvariable. Put it in the before value too. */ } ::set _entry_before [::set $_entry_textvariable_name]; } method pick_button_setup {} { #::qw::entry3::qw_settings_entry #::return [chain]; chain; #//::puts "pgq,debug...::qw::entry3::qw_settings_entry pick_button_setup existing Script==[::bind $_tk_path.pick_button ]"; ::set Emask [::QW::GUI::EVENT::MOUSE::BUTTON::mask]; #::set Emask [::sargs::+= [::sargs .tk_path $_tk_path.pick_button] [::QW::GUI::EVENT::MOUSE::BUTTON::mask]]; #nv2.30.3 (bug fix) - PGQ,DEBUG - fix this if current cell is_dirty - calling pickbutton_buttonPress is the solution #nv2.30.3d (experiment fix) - PGQ,DEBUG - fix this if current cell is_dirty - calling pickbutton_buttonPress is the solution #::set Script [::subst -nocommands {::if {[::qw::command_exists $_tk_path.pick_button]} {$_nv_window pickbutton_buttonPress {$Emask};}}]; ::set Script [::subst -nocommands {::if {[::qw::command_exists $_tk_path.pick_button]} {$_nv_window pickbutton_buttonPress {$Emask};$this entry_activate;}}]; #::set Script [::subst -nocommands {$_nv_window idler_backoff;$_nv_window focusIn;$_nv_window active_cell_commit;$this entry_activate;}]; #::set Script [::subst -nocommands {$_nv_window idler_backoff;$_nv_window focusIn;$this entry_activate;}]; ::bind $_tk_path.pick_button $Script; #::bind $_tk_path.pick_button +$Script; } method bindings_setup {} { #::qw::widget1::qw_settings_entry #::return [chain]; chain; #nv2.30.0 call from validate instead # ::bind $_tk_path.entry [::itcl::code $this entry_commit]; # ::bind $_tk_path.entry [::itcl::code $this entry_make_dirty]; #_pgq,debug230-1 #::bind $_tk_path.entry [::itcl::code $this entry_activate]; #::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window active_cell_commit;$this entry_activate;}]; #nv2.30.3 (bug fix) - PGQ,DEBUG - there is a method for buttonPress #::bind $_tk_path.entry [::subst -nocommands {$_nv_window idler_backoff;$_nv_window focusIn;::puts "qw_entry3 ";$_nv_window active_cell_commit;$this entry_activate;}]; #//::bind $_tk_path.entry [::subst -nocommands {$_nv_window idler_backoff;::puts "qw_entry3 ";[$_nv_window .client] buttonPress;$_nv_window active_cell_commit;$this entry_activate;}]; #nv2.30.3b # ::bind $_tk_path.entry [::subst -nocommands {$_nv_window idler_backoff;[$_nv_window .client] buttonPress;$_nv_window active_cell_commit;$this entry_activate;}]; #nv2.30.3f (bug fix) - can't click into cell to edit it - vicious focus loop with entry_activate marking the selection and putting cursor at the end /* { ::bind $_tk_path.entry [::subst -nocommands { $_nv_window idler_backoff; [$_nv_window .client] buttonPress; ::if {![$this entry_is_dirty]} { $_nv_window active_cell_commit; } $this entry_activate; }]; */} /* { bullshit syntax error - unexpected ternary else - cut out to separate method works ::bind $_tk_path.entry [::subst -nocommands { $_nv_window idler_backoff; ::if {![$this entry_is_dirty]} { $_nv_window active_cell_commit; #$this entry_activate; } #//::puts "pgq,debug2303f...eatme this==$this _nv_window==[$_nv_window odb_path]"; #//::puts "pgq,debug2303f...eatme this==$this window_with_focus==[[[$_nv_window screen] window_with_focus] odb_path]"; ::if {$_nv_window ne [[$_nv_window screen] window_with_focus]} { $_nv_window focusIn; #[$_nv_window .client] buttonPress; } #//::puts "pgq,debug2303f...eatme EXIT"; }]; */} ::bind $_tk_path.entry [::itcl::code $this buttonPress]; #::bind $_tk_path.entry [::subst -nocommands {$_nv_window idler_backoff;::puts "qw_entry3 ";[$_nv_window .client] buttonPress;$this entry_activate;}]; ::if {$::qw::control(control_keypress_p_is_enabled)} { ::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window putsMarkerToListFile {[::QW::GUI::EVENT::KEYBOARD::mask]};}]; ::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window putsMarkerToListFile {[::QW::GUI::EVENT::KEYBOARD::mask]};}]; ::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window peerWidgetTreeExplore {[::QW::GUI::EVENT::KEYBOARD::mask]};}]; } ::set Emask [::QW::GUI::EVENT::MOUSE::WHEEL::mask]; ::bind $_tk_path.entry [::subst -nocommands {$_nv_window idler_backoff;$_nv_window mouse_wheel $Emask;}]; ::bind $_tk_path.entry "[::itcl::code $this edit_delete];"; ::bind $_tk_path.entry "[::itcl::code $this edit_delete];"; ::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window table_notes_procedure_doit {[::QW::GUI::EVENT::KEYBOARD::mask]};}]; ::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window table_notes_procedure_dismiss {[::QW::GUI::EVENT::KEYBOARD::mask]};}]; ::bind $_tk_path.entry [::subst {$_nv_window idler_backoff;$_nv_window help {[::QW::GUI::EVENT::KEYBOARD::mask]};}]; ::return; } method buttonPress {} { $_nv_window idler_backoff; ::if {![$this entry_is_dirty]} { $_nv_window active_cell_commit; #$this entry_activate; } #//::puts "pgq,debug2303f...eatme this==$this"; #//::puts "pgq,debug2303f...eatme _nv_window ==[$_nv_window odb_path]"; #//::puts "pgq,debug2303f...eatme window_with_focus==[[[$_nv_window screen] window_with_focus] odb_path]"; #//::puts "pgq,debug2303f...eatme ::focus==[::focus] ::winfo class==[::winfo class [::focus]]"; #nv2.31.0 #_pgq,debug231 - Entry -> TEntry, and add activeEntryFocusIn line ::if {$_nv_window ne [[$_nv_window screen] window_with_focus]||[::focus] ne ""} { ::switch [::winfo class [::focus]] { "Entry" { [$_nv_window .client] buttonPress; } "TEntry" { $_nv_window activeEntryFocusIn [::sargs .ewidget $this .tkPath $_tk_path.entry .field_path $_nv_field]; } } #$_nv_window focusIn; } #//::puts "pgq,debug2303f...eatme EXIT"; } method edit_delete_test {} { ::qw::try { $this entry_make_dirty; } catch Dummy { ::return; } $this entry_qw_set .after ""; } method edit_delete {} { #$this entry_make_dirty; #$this entry_qw_set .after ""; ::set Rdefs [[[$_nv_window odb_master] ".row_definitions"] odb_get]; ::if {[::sargs::exists $Rdefs $_nv_field]} { $this entry_make_dirty; $this entry_qw_set .after ""; $this entry_commit; } ::switch $_nv_field { .index_path - .rb_name { ::set sargs ""; ::sargs::var::set sargs .settings_field_path $_nv_field; #//::puts "pgq,debug...entry3 edit_delete this==$this"; ::sargs::var::set sargs .widget [::string map [::list :: {}] $this]; [[$_nv_window odb_master] ".client"] keyPress $sargs; } } } method value_get {} { #::qw::entry3::qw_settings_entry /* { The outside world wants the value now, but it could be in the process of being edited. We call edit_check. If the entry is not being edited then it's value will be fine and nothing happens. If it is being edited then an error could be processed. The error has already been handled so we simply throw a priority ignore error. */ } ::set rwb1_debug 0; ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::return $_entry_value; } method value_set {sargs} { #::qw::entry3::qw_settings_entry /* { Not implemented yet. */ } ::set rwb1_debug 0; ::set Value [::sargs::get $_sargs .value]; ::set _entry_value $Value; ::set _entry_before $Value; ::qw::list::var::promote .list _mru_list .element $Value; ::set $_entry_textvariable_name [edit_format]; #::set _date_formatted [::qw::date::format .date $_date .format [::sargs::get $_sargs .date_display_format]]; ::if {$rwb1_debug} {::puts "rwb1_debug,command_proc,1000.6";} ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::if {$rwb1_debug} {::puts "rwb1_debug,command_proc,1000.8";} ::return $_entry_value; } method cell_value_get {} { #::qw::entry3::qw_settings_entry /* { The outside world wants the value now, but it could be in the process of being edited. We call edit_check. If the entry is not being edited then it's value will be fine and nothing happens. If it is being edited then an error could be processed. The error has already been handled so we simply throw a priority ignore error. */ } ::set rwb1_debug 0; ::return [$_tk_path.entry get]; } method cell_value_set {sargs} { #::qw::entry3::qw_settings_entry /* { Not implemented yet. */ } ::set Value [::sargs::get $sargs .value]; ::set $_entry_variable_name $Value; ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::return ""; } method edit_format {} { #::qw::entry3::qw_settings_entry /* { Converts raw value to formatted value that is displayed in the cell. The root method just returns the raw value. Other classes will override. */ } ::qw::bug 314120150924184932 "[::qw::methodname] - unexpected method call."; } method edit_scan {} { #::qw::entry3::qw_settings_entry /* { Convert the cell value from it's formatted form to it's raw value. Throws an exception if there are any problems. This archetype method just returns the cell value without scanning anything. */ } ::qw::bug 314120150924184931 "[::qw::methodname] - unexpected method call."; } method edit_check {} { #::qw::entry3::qw_settings_entry /* { Scans the cell to check validity. Returns 1 if ok and 0 otherwise. Calls edit_scan to perform the check. Used by the focusout validation check and also by value_get before we return the value. If not valid, this method puts up the error message, clears the selection, and puts focus back on the cell. Then it throws an exception with .priority ignore to unwind the stack. We do not let the error get handled by bgerror. The reason is that we want the focus put back in the entry widget and this has to be done after the error message is dismissed because the error dialog takes the focus when it is up. */ } ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_check,1000.0";} ::if {!$_callback_count} { ::return; } ::set Cell $_tk_path.entry; $Cell selection clear; ::set Callback [::sargs::get $_sargs .qw_settings_set_callback]; ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.1";} ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.2";} ::set Command [::lindex $Callback 0]; ::if {![::qw::command_exists $Command]} { ::qw::bug 314120150924185128 "[::qw::methodname] - qw_settings_set_callback command \"$Command\" does not exist."; } ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.3";} ::qw::try { ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.4";} ::lappend Callback .tk_path $_tk_path .before $_entry_before .after [::set $_entry_textvariable_name]; ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.5";} ::incr _callback_count 1; ::qw::finally [::itcl::code $this callback_completed]; ::set After [::uplevel #0 $Callback]; ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.6";} } catch Exception { ::if {$rwb1_debug} {::puts "rwb1_debug,qw_settings_entry,edit_check,1000.7,_entry_textvariable_name==$_entry_textvariable_name";} edit_error [::qw::exception::nest \ .super [::sargs .text "Invalid value \"[::set $_entry_textvariable_name]\"."] \ .sub $Exception \ ]; ::return 0 } ::return 1; } method edit_validate {sargs} { #::qw::entry3::qw_settings_entry #//::puts "pgq,debug232c::qw_settings_entry edit_validate enter ::focus==[::focus] class==[::expr {[::focus] eq ""?{}:[::winfo class [::focus]]}] sargs==(\n[::sargs::format .structure $sargs]\n)"; #::qw::stack_dump; ;#//pgq,debug232c /* { This method is invoked on every possible operation by the cell (tk entry) widget but we are mainly interested in focusin and focusout. Derived callees can override to process additional operations occurring in the cell. */ } ::set rwb1_debug 0; ::set Cell $_tk_path.entry; ::switch -- [::sargs::get $sargs .validate_condition] { focusin { /* { When we receive focus we select everything, turning the cell blue. */ } $Cell selection range 0 end; } focusout { #//::puts "pgq,debug...::qw_settings_entry edit_validate ::focus==[::focus] class==[::winfo class [::focus]] sargs==(\n[::sargs::format .structure $sargs]\n)"; # ::if {[::focus] ne "" && ![::string match ".qw_dialog_*" [::focus]]} {} ::switch -glob -- [::focus] { "" - ".dialog1" - ".qw_dialog_*" {} default { /* { The focus reports the widget we are going to. If it returns empty then we are going outside our application and in that case we don't want to check. The user should be able to leave and come back without interference. It works. We also want to ignore validations when we lose focus to an error prompt as well as an edit assist. */ } #_pgq,debug230-1 - why do this if we are commit before navigate #entry_commit; ;#// useless - error message appears after the window is dismissed /* { ::if {![edit_check]} { ::focus $Cell; }; */ } #_pgq,debug230-1 - why not reclaiming focus - entry_commit is doing it } } } key { #//::puts "pgq,debug::qw_settings_entry edit_validate _tk_path.entry configure==[$_tk_path.entry configure]"; ::foreach Guy [$_tk_path.entry configure] { #//::puts "pgq,debug232c::qw_settings_entry edit_validate _tk_path.entry configure==$Guy"; } ::set Rdefs [[[$_nv_window odb_master] ".row_definitions"] odb_get]; ::if {[::sargs::exists $Rdefs $_nv_field]} { [[$_nv_window odb_master] ".client"] reference_field_keyPress [::sargs::+= $sargs [::sargs ".settings_field_path $_nv_field"]]; ::return 0; } #_pgq,debug230 - check field path universe? ::switch $_nv_field { .index_path - .rb_name { ::if {[::sargs::get $sargs .action_type]==1} { [[$_nv_window odb_master] ".client"] keyPress [::sargs::+= $sargs [::sargs ".settings_field_path $_nv_field"]]; } ::return 0; } } entry_make_dirty; #_pgq,debug2303 - this looks like nonsense? - we just ::set _entry_is_dirty 1; ::if {!$_entry_is_dirty} { ::return 0; } } } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.7";} ::return 1; } method edit_throw {sargs} { #//::puts "pgq,debug232c::qw_settings_entry edit_throw enter _exception==(\n[::sargs::format .structure $_exception]\n)"; ::if {$_exception eq ""} { ::return; } ::set Exception $_exception; ::set _exception ""; ::foreach Guy [$_tk_path.entry configure] { #//::puts "pgq,debug232c::qw_settings_entry edit_throw _tk_path.entry configure==$Guy"; } ::set Script [::subst -nocommands {::if {[::qw::command_exists $_tk_path.entry]} {$_tk_path.entry configure -validate all}}]; ::if {$_idle_id_edit_throw ne ""} { ::after cancel $_idle_id_edit_throw; } ::set _idle_id_edit_throw [::after idle [::itcl::code $Script]]; ::qw::throw $Exception; } /* { 2.30.0 - replaced method edit_validate {sargs} { #::qw::entry3::qw_settings_entry /* { This method is invoked on every possible operation be the cell (tk entry) widget but we are mainly interested in focusin and focusout. Derived callses can override to process additional operations occurring in the cell. */ } ::set rwb1_debug 0; ::set Cell $_tk_path.entry; ::switch -- [::sargs::get $sargs .validate_condition] { focusin { /* { When we receive focus we select everything, turning the cell blue. */ } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.3";} $Cell selection range 0 end; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.4";} } focusout { ::if {[::focus] ne ""} { /* { The focus reports the widget we are going to. If it returns empty then we are going outside our application and in that case we don't want to check. The user should be able to leave and come back without interference. It works. */ } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.5";} edit_check; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.6";} } } } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_validate,1000.7";} ::return 1; } */ } method qw_settings_set_after {sargs} { #::qw::entry3::qw_settings_entry ::set After [::sargs::get $sargs .after]; ::set [::set $_entry_textvariable_name] $After; ::set _entry_before $After; $_tk_path.entry selection range 0 end; } method edit_pick {} { #::qw::entry3::qw_settings_entry /* { We call back because the pick was invoked. The callback will do most of the rest. It will collect the pick and call back with the */ } # ::puts "pgq,debug666::qw::entry3::qw_settings_entry edit_pick _sargs==(\n[::sargs::format .structure $_sargs]\n)"; ::set Callback [::sargs::get $_sargs .qw_settings_pick_callback]; ::set Command [::lindex $Callback 0]; ::if {![::qw::command_exists $Command]} { ::qw::bug 314120151006134449 "[::qw::methodname] - qw_settings_pick_callback command \"$Command\" does not exist."; } ::qw::try { ::lappend Callback .tk_path $_tk_path .before $_entry_before .after [::set $_entry_textvariable_name] .keySymbolString F3 .settings_field_path $_nv_field; # ::puts "pgq,debug666::qw::entry3::qw_settings_entry edit_pick Callback==$Callback"; #//::puts "pgq,debug::qw::entry3::qw_settings_entry edit_pick Callback args==(\n[::sargs::format .structure [::lindex $Callback 1 end]]\n)"; ::set After [::uplevel #0 $Callback]; } catch Exception { ::set Label [::sargs::get $_sargs .label.text]; ::if {$Label eq ""} { ::set Label [::sargs::get $_sargs .labelframe.text]; } ::if {$Label ne ""} { edit_error [::qw::exception::nest \ .super [::sargs .text "Field \"$Label\" - invalid value."] \ .sub $Exception \ ]; } else { edit_error $Exception; } } focusIn $_tk_path.entry; } method edit_restore {sargs} { #::qw::entry3::qw_settings_entry /* { Typically invoked by but can also be called from the outside. */ } ::if {!$_entry_is_dirty} { ::return; } ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_restore,1000.0,_entry_before==$_entry_before,textvariable==[::set $_entry_textvariable_name]";} ::set $_entry_textvariable_name $_entry_before; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_restore,1000.1";} $_tk_path.entry selection range 0 end; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_restore,1000.2";} } } # ------------------------------------------------------------ # ::qw::entry3::date # ------------------------------------------------------------ ::proc ::qw::entry3::date {TkPath sargs} { #::qw::entry3::date ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::date1] } ::itcl::class ::qw::entry3::date1 { inherit ::qw::entry3::archetype; method sargs_setup {} { #::qw::entry3::date chain; ::sargs::var::+= _sargs [::sargs \ .date_entry_format ddmmyyyy \ .date_display_format $::qw::date::formats(ddmonthyyyy) \ ]; } method user_setup {} { chain; ::if {$_user ne ""} { /* { If the date entry and display formats are supplied we use them. Otherwise, if there is a user we use that user's date entry and display formats. Otherwise we revert to the formats hard-wired in sargs_setup. */ } ::if {[::sargs::get $_sargs .date_display_format] eq ""} { ::sargs::var::set _sargs .date_display_format $::qw::date::formats([[$_user .options.date.format] odb_get]); } ::if {[::sargs::get $_sargs .date_entry_format] eq ""} { ::sargs::var::set _sargs .date_entry_format [[$_user .options.date.entry] odb_get]; } } } method value_set {sargs} { #::qw::entry3::date /* { Not implemented yet. */ } ::qw::throw "314120150324162426 - set not implemented yet."; ::set Value [::sargs::get $sargs .value]; ::set Value [::string trim $Value]; ::set Value [::string range $Value 0 7]; ::return [chain $sargs .value $Value]; } method edit_format {} { #::qw::entry3::date /* { Takes the _entry_value, formats it, and sets the textvariable to the formatted value. */ } ::if {$_entry_value eq ""} { ::return ""; } ::return [::qw::date::format .date $_entry_value .format [::sargs::get $_sargs .date_display_format]]; } method edit_scan {} { #::qw::entry3::date /* { Calling gui_edit allows the implementation of ddmmyyyy NewViews date entry protocol where the minimum keystrokes can be used to change a date. However, the before value is needed to accomplish this merge with the user's changes as held in the _entry_textvariable. */ } ::set After [::qw::date::gui_edit \ .before $_entry_before \ .after [::set $_entry_textvariable_name] \ .entry_format [::sargs::get $_sargs .date_entry_format] \ ]; ::return $After; } method edit_pick {} { #::qw::entry3::date ::set rwb1_debug 0; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.0";} ::if {![edit_check]} { ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.1";} ::return; } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.3";} ::set Default $_entry_value; ::if {$Default eq ""} { ::set Default [::clock format [::clock seconds] -format %Y%m%d]; } ::set ReturnStructure [::qw::dialog85::date \ .default $Default \ .bbox [::qw::winutil::bbox_from_widget .widget $_tk_path.entry] \ ]; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.4";} ::set Result [::sargs::get $ReturnStructure .result]; ::if {$Result ne ""} { ::set _entry_value $Result; ::set _entry_before $Result; ::set $_entry_textvariable_name [edit_format]; ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.5";} ::return ""; } ::if {$rwb1_debug} {::puts "rwb1_debug,edit_pick,1000.6";} ::return; } } # ------------------------------------------------------------ # ::qw::entry3::currency # ------------------------------------------------------------ ::proc ::qw::entry3::currency {TkPath sargs} { #::qw::entry3::currency ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::currency1] } ::itcl::class ::qw::entry3::currency1 { inherit ::qw::entry3::archetype; method sargs_setup {} { #::qw::entry3::currency chain; ::sargs::var::+= _sargs [::sargs \ .currency_display_format $::qw::number::formats(dollar_minus_parentheses) \ ]; } method user_setup {} { chain; ::if {$_user ne ""} { /* { If the date entry and display formats are supplied we use them. Otherwise, if there is a user we use that user's date entry and display formats. Otherwise we revert to the formats hard-wired in sargs_setup. */ } ::if {[::sargs::get $_sargs .currency_display_format] eq ""} { ::sargs::var::set _sargs .currence_display_format $::qw::number::formats([[$_user .options.currency.format] odb_get]); } } } method value_set {sargs} { #::qw::entry3::currency /* { Not implemented yet. */ } ::qw::throw "314120150324162426 - set not implemented yet."; # ::set Value [::sargs::get $sargs .value]; # ::set Value [::string trim $Value]; # ::set Value [::string range $Value 0 7]; ::return [chain $sargs .value $Value]; } method edit_format {} { #::qw::entry3::currency /* { Takes the _entry_value, formats it, and sets the textvariable to the formatted value. */ } ::if {$_entry_value eq ""} { ::return ""; } ::return [::qw::number::format .value $_entry_value .format [::sargs::get $_sargs .currency_display_format]]; } method edit_scan {} { #::qw::entry3::currency /* { */ } ::set After [::qw::real::scan [::set $_entry_textvariable_name]]; ::set After [::format %.2f $After]; ::return $After; } } # ------------------------------------------------------------ # ::qw::entry3::list_entry # ------------------------------------------------------------ ::proc ::qw::entry3::list {TkPath sargs} { #::qw::entry3::list_entry ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::list1] } ::itcl::class ::qw::entry3::list1 { #::qw::entry3::list_entry_widget /* { The list entry provides the list of values from which the user must pick. */ } inherit ::qw::entry3::archetype; method value_set {sargs} { #::qw::entry3::list /* { Not implemented yet. */ } ::qw::throw "314120150324162426 - set not implemented yet."; # ::set Value [::sargs::get $sargs .value]; # ::set Value [::string trim $Value]; # ::set Value [::string range $Value 0 7]; ::return [chain $sargs .value $Value]; } method edit_scan {} { #::qw::entry3::list1 /* { */ } ::set Value [::set $_entry_textvariable_name]; ::set List [::sargs::get $_sargs .list]; ::if {$Value eq ""} { ::return ""; } ::set After [edit_find .value $Value .list $List]; ::if {$After eq ""} { ::set ListText [::join $List "\n"]; ::qw::throw \ .text "Value \"$Value\" is not in the expected list of values." \ .help_page [::subst -nocommands { .id 314120150708150045 .tags {error} .body { [p { The value you entered is invalid. Acceptable values are: }] [pre {$ListText}] } }] \ ; } ::return $After; } method edit_find {sargs} { #::qw::entry3::list1 /* { We are given an value and a list. We want to return the list value that best matches the value. For now we will string first against each value and return the first one that matches. */ } ::set Value [::sargs::get $sargs .value]; ::set Value [::string trim $Value]; ::set Value [::string tolower $Value]; ::if {$Value eq ""} { ::return $Value; } ::set List [::sargs::get $sargs .list]; ::foreach Item $List { ::set Pos [::string first $Value [::string tolower $Item]]; ::if {$Pos==0} { ::return $Item; } } ::return ""; ::qw::throw "Invalid value \"$Value\"; it must match a list item."; } method edit_pick {} { #::qw::entry3::list1 #//::puts "pgq,debug::qw::entry3::list1 edit_pick enter _sargs==(\n[::sargs::format .structure $_sargs]\n)"; #::qw::stack_dump; ;#//pgq,debug #::qw::entry3::archetype # ::if {![edit_check]} { # ::return; # } ::set Cell $_tk_path.entry; # ::set Default [::set $_entry_textvariable_name]; # ::if {$Default eq ""} { # ::sargs::var::set sargs .default [::lindex [::sargs::get $_sargs .list] 0]; # } #- changed .title from ".labelframe.text" to ".label.text" ::set ResultStructure [::qw::dialog85::mru_list \ .title [::sargs::get $_sargs .label.text] \ .browse_type "" \ .mru_list [::sargs::get $_sargs .list] \ .bbox [::qw::winutil::bbox_from_widget .widget $_tk_path.entry] \ .width [::sargs::get $_sargs .width] \ ]; /* { Note that we update the _mru_list whether anything was selected or not when we popped up the mru_list dialog. */ } # ::set _mru_list [::sargs::get $ResultStructure .mru_list]; ::set Result [::sargs::get $ResultStructure .result]; # ::qw::list::var::promote .list _mru_list .element $Result; ::if {$Result ne ""} { /* { If a value was selected update the current and before values. we also update the mru_list. will do nothing now. */ } ::set $_entry_textvariable_name $Result; ::set _entry_value_before $Result; } } } # ------------------------------------------------------------ # ::qw::entry3::website_entry # ------------------------------------------------------------ ::proc ::qw::entry3::website {TkPath sargs} { ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::website1] } ::itcl::class ::qw::entry3::website1 { inherit ::qw::entry3::archetype; method bindings_setup {} { #::qw::entry3::website chain; ::bind $_tk_path.entry [::itcl::code $this launch_browser]; } method edit_scan {} { ::set EntryUrl [::set $_entry_textvariable_name] ::if {$EntryUrl eq ""} { ::return ""; } ::set FirstFourChars [::string range $EntryUrl 0 3]; ::if {$FirstFourChars ne "http"} { ::set EntryUrl_with_http "http://$EntryUrl"; } else { ::set EntryUrl_with_http $EntryUrl; } ::if {[::regexp -- {^(https?://[a-z0-9\-]+\.[a-z0-9\-\.]+(?:/|(?:/[a-zA-Z0-9!#\$%&'\*\+,\-\.:;=\?@\[\]_~]+)*))$} $EntryUrl_with_http match url]} { puts "valid website"; } else { ::qw::throw [::sargs \ .text "Invalid Website \"$EntryUrl\"." \ .help_id 271820050404144820 \ ]; } ::return $EntryUrl; } method launch_browser {} { ::set EntryUrl [::set $_entry_textvariable_name]; ::set FirstFourChars [::string range $EntryUrl 0 3]; ::if {$FirstFourChars ne "http"} { ::set EntryUrl_with_http "http://$EntryUrl"; } else { ::set EntryUrl_with_http $EntryUrl; } ::if {[::regexp -- {^(https?://[a-z0-9\-]+\.[a-z0-9\-\.]+(?:/|(?:/[a-zA-Z0-9!#\$%&'\*\+,\-\.:;=\?@\[\]_~]+)*))$} $EntryUrl_with_http match url]} { #::eval exec [::auto_execok start] \"\" $EntryUrl; ::exec [::file join $::env(ComSpec)] << "start \"\" \"$EntryUrl\" \n exit \n"; } } } # ------------------------------------------------------------ # ::qw::entry3::phone_entry # # Looks like this will not be used but I'm going to leave it here anyways # in case we decide to use it. # ------------------------------------------------------------ ::proc ::qw::entry3::phone {TkPath sargs} { ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::phone1] } ::itcl::class ::qw::entry3::phone1 { inherit ::qw::entry3::archetype; constructor {} { } method edit_scan {} { ::set PhoneNumber [::set $_entry_textvariable_name]; ::if {$PhoneNumber eq ""} { ::return ""; } ::if {[::regexp -- {^(\+?\d{1,2}[\s.-]?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$} $PhoneNumber match url]} { puts "valid phone number"; } else { ::qw::throw [::sargs \ .text "Invalid Phone Number \"$PhoneNumber\"." \ .help_id 271820050404144820 \ ]; } ::return $PhoneNumber; } } # ------------------------------------------------------------ # ::qw::entry3::printer_entry # ------------------------------------------------------------ ::proc ::qw::entry3::printer {TkPath sargs} { ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::printer1] } ::itcl::class ::qw::entry3::printer1 { inherit ::qw::entry3::archetype; constructor {} { } method edit_pick {} { ::set Printer [[::qw::get_printers] select]; puts $Printer ::if {$Printer eq ""} { ::return ""; } else { ::set _entry_value [$Printer name_Get]; ::set _entry_before [$Printer name_Get]; ::set $_entry_textvariable_name [edit_format]; } } method edit_validate {sargs} { ::set EntryWidget $_tk_path.entry; ::switch -- [::sargs::get $sargs .validate_condition] { key { edit_error [::sargs \ .text "The printer name cannot be typed in. Press F3 to select a printer" \ .help_page [::subst -nocommands { .id 314120150710143249 .tags {error} .title "Hello World!" .body { [p { hello world! }] } }] \ ]; ::return 0; } } ::return [chain $sargs]; } } # ------------------------------------------------------------ # ::qw::entry3::number_entry # ------------------------------------------------------------ ::proc ::qw::entry3::number {TkPath sargs} { ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::number1] } ::itcl::class ::qw::entry3::number1 { inherit ::qw::entry3::archetype; method edit_validate {sargs} { ::if {[::sargs::get $sargs .value_new] eq ""} { ::return 1; } ::switch -- [::sargs::get $sargs .validate_condition] { key { ::if {![::regexp {^[0-9]*$} [::sargs::get $sargs .value_insert_delete]]} { edit_error [::sargs \ .text "This field only takes numbers" \ .help_page { .id 314120150710143250 .title "Hello World!" .body { [p { hello world! }] } } ]; ::return 0; } } focusout { ::if {[::focus] ne ""} { ::if {![::sargs::boolean_get $_sargs .is_range]} { ::return [chain $sargs]; } ::if {[::sargs::get $_sargs .lower] > [::sargs::get $sargs .value_new] \ ||[::sargs::get $_sargs .upper] < [::sargs::get $sargs .value_new] \ } { edit_error [::sargs \ .text "This field only takes values between [::sargs::get $_sargs .lower] and [::sargs::get $_sargs .upper]" \ .help_page { .id 314120150710143251 .title "Hello World!" .body { [p { hello world! }] } } ]; } } } } ::return [chain $sargs]; } } # ------------------------------------------------------------ # ::qw::entry3::file_entry # ------------------------------------------------------------ ::proc ::qw::entry3::file {TkPath sargs} { ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::file1] } ::itcl::class ::qw::entry3::file1 { inherit ::qw::entry3::archetype; method edit_pick {} { ::set Result [::qw::dialog85::mru_list \ .browse_type tk_getOpenFile \ .title "Select File" \ .bbox [::qw::winutil::bbox_from_widget .widget $_tk_path.entry] \ .mru_list [::sargs::get $_sargs .mru_list] \ ]; ::if {$Result eq ""} { ::return ""; } ::set File [::sargs::get $Result .result]; ::set _entry_value $File; ::set _entry_before $File; ::set $_entry_textvariable_name [edit_format]; } } # ------------------------------------------------------------ # ::qw::entry3::checkbutton_widget # ------------------------------------------------------------ ::proc ::qw::entry3::checkbutton {TkPath sargs} { #//::puts "tbf_debug helper proc" ::return [create_helper $sargs .tkpath $TkPath .prompt_class ::qw::entry3::checkbutton_widget] } ::itcl::class ::qw::entry3::checkbutton_widget { inherit ::qw::entry3::archetype; method sargs_setup {} { chain; ::sargs::var::+= _sargs [::sargs \ .check_text "" \ .onvalue "yes" \ .offvalue "no" ]; } method cell_widget_setup {} { ::if {![::qw::command_exists $_tk_path.entry]} { ::ttk::checkbutton $_tk_path.entry \ -state normal \ -variable $_entry_textvariable_name \ -text [::sargs::get $_sargs .check_text] \ -onvalue [::sargs::get $_sargs .onvalue] \ -offvalue [::sargs::get $_sargs .offvalue] \ ; ::pack $_tk_path.entry -side left -expand 1 -padx 4 -anchor w; } } method pick_button_setup {} { # -------------------------------------------------------- # pick_button_setup not necessary for checkbutton # -------------------------------------------------------- } method bindings_setup {} { ::bind $_tk_path.entry [::itcl::code $this focus_prev]; ::bind $_tk_path.entry [::itcl::code $this focus_next]; ::bind $_tk_path.entry [::itcl::code $this focus_next]; ::bind $_tk_path [::list ::itcl::delete object $_tk_path]; } method value_get {} { ::return $_entry_value; } method value_set {sargs} { #::qw::widget1::archetype_entry /* { Not implemented yet. */ } ::set rwb1_debug 0 ::set Value [::sargs::get $_sargs .value]; ::set _entry_value $Value; ::set _entry_before $Value; ::set $_entry_textvariable_name [edit_format]; ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::return $_entry_value; } method cell_value_get {} { ::return $_entry_value; } method cell_value_set {sargs} { #::qw::widget1::archetype_entry /* { Not implemented yet. */ } ::set Value [::sargs::get $sargs .value]; ::set $_entry_variable_name $Value; ::if {![edit_check]} { ::qw::throw .text "Entry widget already processed the error." .priority ignore; } ::return ""; } method edit_check {} { ::set After [edit_scan]; ::set _entry_value $After; ::set _entry_before $After; ::set $_entry_textvariable_name [edit_format]; ::return 1; } method edit_validate {sargs} {} method edit_pick {} {} method edit_restore {sargs} {} method edit_error {sargs} {} }