::namespace eval ::qw::dialog {}; ::proc ::qw::dialog::timeentry {args} { ::qw::s_args_marshal; ::qw::try { ::set Toplevel ""; ::set Args [::sargs::get $::qw::options .window]; # ::sargs::var::+= Args [::sargs::get $::qw::options .window.dialog.list]; ::sargs::var::+= Args [::sargs::get $::qw::options .window.dialog.timeentry]; ::sargs::var::+= Args $s_args; ::set Toplevel [::qw::dialog::create $Args]; ::set Info ${Toplevel}.info; ::set TimeEntry [::eval ::QW::WIDGET::TIMEENTRY $Info.list $s_args]; ::pack $Info.list -expand 1 -fill both; # ::set Args [::sargs::set $Args /button/select.command [::format {::set ::qw::dialog::result [%s selected];} $TimeEntry]]; #? ::sargs::var::set Args /button/select.command [::format {::set ::qw::dialog::result [%s selected];} $TimeEntry]; ::sargs::var::set Args /button/select.command [::format {::set ::qw::dialog::result [%s selected];} $TimeEntry]; ::set Help [::sargs::get $Args .help]; #? ::sargs::var::set Args /button/help.command [::list ::qw::dialog::list_help $Help]; ::bind $Toplevel [::list ::qw::dialog::list_help $Help]; ::set Controls ${Toplevel}.controls; ::foreach {Column Button} {0 select 1 cancel 2 help} { ::button $Controls.${Button} \ -text [::sargs::get_poly $Args /button/${Button}.text] \ -command [::sargs::get_poly $Args /button/${Button}.command] \ -font [::sargs::get_poly $Args /button/${Button}.font] \ -borderwidth [::sargs::get_poly $Args /button.border.width] \ ; ::grid $Controls.${Button} -row 0 -column $Column -sticky nesw \ -padx [::sargs::get_poly $Args /button/${Button}.pad.external.x] \ -pady [::sargs::get_poly $Args /button/${Button}.pad.external.y] \ ; ::grid columnconfigure $Controls $Column -weight 1; } ::raise $Toplevel; ::focus $Controls.select; ::wm protocol $Toplevel WM_DELETE_WINDOW "$Controls.cancel invoke"; ::bind $Toplevel "$Controls.select invoke"; ::bind $Toplevel "$Controls.cancel invoke"; ::bind $Toplevel "$Controls.select invoke"; ::bind $Toplevel "$Controls.select invoke"; ::qw::dialog::wait .toplevel $Toplevel .variable ::qw::dialog::result; ::destroy $Toplevel ::return $::qw::dialog::result; } catch Exception { ::if {$Toplevel ne ""&&[::winfo exists $Toplevel]} { ::qw::try { ::destroy $Toplevel; } catch Dummy {} } ::qw::throw [::qw::exception::nest .sub $Exception .super "Could not create a time entry dialog with arguments \"$s_args\"."]; } } ::if {$::rwb1_debug} {::puts "rwb1_debug,qw.qw_tcl,global,1000.11.4";} # ------------------------------------------------------------ # ::QW::WIDGET::TIMEENTRY class # ------------------------------------------------------------ ::itcl::class ::QW::WIDGET::TIMEENTRY { inherit ::itk::Widget # protected variable _scrolledlistbox ""; protected variable _timeentry ""; protected variable _entryfield ""; protected variable _default ""; protected variable _options ""; method select {Date} { ::qw::bug 907020030918120155; return $this; } method selected {} { ::set Time [::clock format [::clock scan [$_timeentry get]] -format "%H %M %S"]; ::set Result $_default; # ::if {$Result eq ""} {::set Result "00000101000000"} ::if {$Result eq ""} {::set Result "19700101000000"} ::set Result [::qw::date::set $Result "hour" [::lindex $Time 0]]; ::set Result [::qw::date::set $Result "minute" [::lindex $Time 1]]; ::set Result [::qw::date::set $Result "second" [::lindex $Time 2]]; ::return $Result; } method option_get {Path} {::return [::sargs::get_poly $_options $Path];} method constructor {args} { ::set _options $::qw::widget::options; ::sargs::var::+= _options [::subst { .default {} }]; ::sargs::var::+= _options $args; ::set Me $itk_interior; #nv2.28.2 (tcl86) - ::QW::WIDGET::TIMEENTRY constructor #::set _timeentry [::iwidgets::timeentry $Me.timeentry]; ::set _defaultIcon [image create bitmap -data { #define watch1a_width 20 #define watch1a_height 20 static char watch1a_bits[] = { 0x40,0x40,0xf0,0xe0,0x7f,0xf0,0xe0,0xe0,0xf0,0x30, 0x80,0xf1,0x88,0x04,0xf2,0x0c,0x00,0xf6,0x04,0x04, 0xf4,0x94,0x84,0xf5,0x02,0x06,0xf8,0x02,0x0c,0xf8, 0x12,0x7e,0xf9,0x02,0x04,0xf8,0x02,0x24,0xf8,0x04, 0x00,0xf5,0x04,0x00,0xf4,0x88,0x02,0xf2,0x88,0x64, 0xf2,0x30,0x80,0xf1,0xe0,0x60,0xf0,0xe0,0xff,0xf0 }; }] ::set _timeentry [::iwidgets::timeentry $Me.timeentry -icon $_defaultIcon]; #// ::set _entryfield [$_timeentry component label]; ::pack $_timeentry -expand 1 -fill both $_entryfield configure -font [option_get .font]; # ::set _default [option_get .default]; ::if {$_default eq ""} { # ::set _default "00000101000000" ::set _default "19700101000000" ::set Time [::clock format [::clock seconds] -format "%H %M %S"]; ::set _default [::qw::date::set $_default "hour" [::lindex $Time 0]]; ::set _default [::qw::date::set $_default "minute" [::lindex $Time 1]]; ::set _default [::qw::date::set $_default "second" [::lindex $Time 2]]; } ::set Hour [::qw::date::get $_default "hour"]; ::set Minute [::qw::date::get $_default "minute"]; ::set Second [::qw::date::get $_default "second"]; ::set Time "$Hour:$Minute:$Second"; $_timeentry show $Time; # $_timeentry configure -dblclickcommand "$Controls.select invoke"; ::eval itk_initialize; } }