From: Keith on

I have a widget that creates the number of entry boxes depending on the
number of items from the clipboard. I kill the widget by using
destory .widgetname
however if the number of entry boxes needed for the new operation are less
then the prior widget then the previous entry boxes are recreated.

1st widget
entry box 1
entry box 2
entry box 3
entry box 4
entry box 5

2nd widget
entry box 1 (Created from paste operation)
entry box 2 (Created from paste operation)
entry box 3 (recreated from prior op)
entry box 4 (recreated from prior op)
entry box 5 (recreated from prior op)

What do I need to do so that the old entry boxes are not recreated when the
widget is remade?

From: Arjen Markus on
On 12 apr, 09:47, Keith <kilowattra...(a)use-reply-to.invalid> wrote:
> I have a widget that creates the number of entry boxes depending on the
> number of items from the clipboard. I kill the widget by using
> destory .widgetname
> however if the number of entry boxes needed for the new operation are less
> then the prior widget then the previous entry boxes are recreated.
>
> 1st widget
> entry box 1
> entry box 2
> entry box 3
> entry box 4
> entry box 5
>
> 2nd widget
> entry box 1 (Created from paste operation)
> entry box 2 (Created from paste operation)
> entry box 3 (recreated from prior op)
> entry box 4 (recreated from prior op)
> entry box 5 (recreated from prior op)
>
> What do I need to do so that the old entry boxes are not recreated when the
> widget is remade?

Could you post actual code that exhibits this behaviour?
It could well come from the clipboard - old entries still existing -
so
it is very difficult to reconstruct your problem from merely this
description.

Regards,

Arjen
From: Keith on
On Mon, 12 Apr 2010 00:59:38 -0700 (PDT), Arjen Markus <arjen.markus895(a)gmail.com> wrote:

>On 12 apr, 09:47, Keith <kilowattra...(a)use-reply-to.invalid> wrote:
>> I have a widget that creates the number of entry boxes depending on the
>> number of items from the clipboard. I kill the widget by using
>> destory .widgetname
>> however if the number of entry boxes needed for the new operation are less
>> then the prior widget then the previous entry boxes are recreated.
>>
>> 1st widget
>> entry box 1
>> entry box 2
>> entry box 3
>> entry box 4
>> entry box 5
>>
>> 2nd widget
>> entry box 1 (Created from paste operation)
>> entry box 2 (Created from paste operation)
>> entry box 3 (recreated from prior op)
>> entry box 4 (recreated from prior op)
>> entry box 5 (recreated from prior op)
>>
>> What do I need to do so that the old entry boxes are not recreated when the
>> widget is remade?
>
>Could you post actual code that exhibits this behaviour?
>It could well come from the clipboard - old entries still existing -
>so
>it is very difficult to reconstruct your problem from merely this
>description.
>
>Regards,
>
>Arjen


grid [ frame $t.g -bg white ] -row 1 -column 0 -sticky w
lsort [set clip(hj) [array names clip2]]
label $t.g.d -bg white
grid $t.g.d -row 0 -column 0 -sticky news
foreach r $clip(hj) {
set wid [string length $clip2($r)]
lassign [split $r ,] rw co
checkbutton $t.g.a$r -variable clip(ex,$r) -text Exclude -onvalue 1 -offvalue 0 -anchor center -font $fn(1)
entry $t.g.c$r -textvariable clip2($r) -width $wid -justify left -bd 4 -bg aliceblue -fg red -font $fn(2)
#-state disabled
grid $t.g.a$r -row [expr $rw +1] -column 0 -sticky news
grid $t.g.c$r -row [expr $rw +1] -column [expr $co +1] -sticky news
puts stdout "r $r \nclip(hj) $clip(hj)"
}

grid [ labelframe $t.h -text Select -bg white -relief raised -bd 5 -bg aliceblue ] -row 2 -column 0
grid [ frame $t.h.a -bg white -relief sunken -bd 5 -bg aliceblue ] -row 0 -column 0
ttk::button $t.h.a.1 -text "Import Trunked Frequencies" -command {\
set gu -1
lsort [set clip(hj) [array names tty]]
foreach r $clip(hj) {\
set f [llength $tty($r)]
for {set e 0} {$e <= $f} {incr e 1} {\
set tyu "[lindex $tty($r) $e]"
if {[regexp {\d\d\d\.\d} $tyu] == 1 } {\
regsub -all {[[:alpha:]]} $tyu {} tyu
incr gu 1
set tfq(frq,[expr ($gu + $clip(rt)) +1]) "$tyu"
puts stdout "$tfq(frq,[expr ($gu + $clip(rt)) +1]) $tyu"
}
}

}
}
ttk::button $t.h.a.2 -text Paste -command {unset -nocomplain clip2 clip tty; clip_get a}
ttk::button $t.h.a.3 -text Close -command {unset -nocomplain clip2; destroy .xcget}
grid $t.h.a.1 -row 0 -column 0 -sticky news
grid $t.h.a.2 -row 0 -column 5 -sticky news
grid $t.h.a.3 -row 0 -column 6 -sticky news

From: Arjen Markus on
On 12 apr, 10:42, Keith <kilowattra...(a)use-reply-to.invalid> wrote:
> On Mon, 12 Apr 2010 00:59:38 -0700 (PDT), Arjen Markus
>
>
>
>
>
> <arjen.markus...(a)gmail.com> wrote:
> >On 12 apr, 09:47, Keith <kilowattra...(a)use-reply-to.invalid> wrote:
> >> I have a widget that creates the number of entry boxes depending on the
> >> number of items from the clipboard. I kill the widget by using
> >> destory .widgetname
> >> however if the number of entry boxes needed for the new operation are less
> >> then the prior widget then the previous entry boxes are recreated.
>
> >> 1st widget
> >> entry box 1
> >> entry box 2
> >> entry box 3
> >> entry box 4
> >> entry box 5
>
> >> 2nd widget
> >> entry box 1 (Created from paste operation)
> >> entry box 2 (Created from paste operation)
> >> entry box 3 (recreated from prior op)
> >> entry box 4 (recreated from prior op)
> >> entry box 5 (recreated from prior op)
>
> >> What do I need to do so that the old entry boxes are not recreated when the
> >> widget is remade?
>
> >Could you post actual code that exhibits this behaviour?
> >It could well come from the clipboard - old entries still existing -
> >so
> >it is very difficult to reconstruct your problem from merely this
> >description.
>
> >Regards,
>
> >Arjen
>
> grid [ frame  $t.g -bg white ] -row 1 -column 0 -sticky w
> lsort [set clip(hj) [array names clip2]]
> label         $t.g.d -bg white
> grid          $t.g.d -row 0 -column 0 -sticky news
> foreach r $clip(hj) {
> set wid [string length $clip2($r)]
> lassign [split $r ,] rw co
> checkbutton   $t.g.a$r -variable     clip(ex,$r) -text Exclude -onvalue 1
> -offvalue 0 -anchor center -font $fn(1)
> entry         $t.g.c$r -textvariable clip2($r)   -width $wid -justify left
> -bd 4 -bg aliceblue -fg red -font $fn(2)
> #-state disabled
> grid          $t.g.a$r -row [expr $rw +1] -column 0 -sticky news
> grid          $t.g.c$r -row [expr $rw +1] -column [expr $co +1] -sticky news
> puts stdout "r $r \nclip(hj) $clip(hj)"
>
> }
>
> grid [ labelframe $t.h -text Select -bg white -relief raised -bd 5 -bg
> aliceblue ] -row 2 -column 0
> grid [ frame $t.h.a -bg white -relief sunken -bd 5 -bg aliceblue ] -row 0
> -column 0
> ttk::button        $t.h.a.1  -text "Import Trunked Frequencies" -command {\
> set gu -1
> lsort [set clip(hj) [array names tty]]
> foreach r $clip(hj) {\
>     set f [llength $tty($r)]
>         for {set e 0} {$e <= $f} {incr e 1} {\
>             set tyu "[lindex $tty($r) $e]"
>             if {[regexp {\d\d\d\.\d} $tyu] == 1 } {\
>             regsub -all {[[:alpha:]]} $tyu {} tyu
>             incr gu 1
>             set tfq(frq,[expr ($gu + $clip(rt)) +1]) "$tyu"
>             puts stdout "$tfq(frq,[expr ($gu + $clip(rt)) +1]) $tyu"
>             }
>         }
>
> }
> }
>
> ttk::button  $t.h.a.2  -text Paste -command {unset -nocomplain clip2 clip
> tty; clip_get a}
> ttk::button  $t.h.a.3  -text Close -command {unset -nocomplain clip2;
> destroy .xcget}
> grid         $t.h.a.1  -row 0 -column 0 -sticky news
> grid         $t.h.a.2 -row 0 -column 5 -sticky news
> grid         $t.h.a.3 -row 0 -column 6 -sticky news- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Just a hunch, I have no time atm to analyse the code more closely,
but:
- widgets like the entry widget use use traces on the variables they
are
associated with
- unsetting the variable may not be enough - the trace creates it
again
- the best way is to first destroy the widgets and then unset the
variables,
otherwise they may magically reappear

(I learned that in a somewhat similar situation :))

Regards,

Arjen
From: Keith on
On Mon, 12 Apr 2010 01:48:35 -0700 (PDT), Arjen Markus
<arjen.markus895(a)gmail.com> wrote:

>- unsetting the variable may not be enough - the trace creates it
>again
>- the best way is to first destroy the widgets and then unset the
>variables,
> otherwise they may magically reappear
>
>(I learned that in a somewhat similar situation :))

Do you mean actually use destroy on the entry widget's path?

destroy .widget.entry.1
??