Re: tk widget



Hi
The fields are sys_ser, mb_ser that is another field from an array. I
am putting the data in address(FN) and then clearing it in Clear_ALL
procedure whihc is not getting cleared unless I use a foreach, which is
OK in most part. But if the user presses a Clear at the beginning of
the field then it cannot read the variable SCR3 as it is set only on a
return TAB.
Also how do I make the Clear Button and Done button appear only in
the second form only? This was another thing I thought about. Do I use
winfo exist on Done button Frame? Or is there a way to dull out the
Clear Button for the first form and make active only when all fields
appear? If so please let me know how.

Thanks
kc

Bryan Oakley wrote:
> krithiga81@xxxxxxxxx wrote:
> > Hello
> > In the example you provided to set the form, I am setting my form the
> > following way. I derive the fields from a list.
> >
> > set partnum $address(partnum)
> > if {[string compare $DefaultScreen startup] == 0} {
> > puts " I am in display screen1"
> > set SCR1 startup
> > } else {
> > set SCR1 $DefaultScreen
> >
> > }
> >
> >
> > set frame .form-$SCR1
> >
> > set SCR2 [lindex $SCRDEF($SCR1) 0 ]
> > puts $SCR2
> >
> > set SCR3 [split $SCR2 , ]
> > set address(SCR3) $SCR3
> >
> > If I do a foreach FN $SCRDEF($SCR1) - It is returning a whole string
> > and FN is returned as {sys_ser, mb_ser...}
> > Then I do foreach FN $SCR3 {
> >
> > ..set up frame. etc
> >
> > }
>
> If your data is truly {sys_ser, mb_ser..} Then FN will have the value
> "sys_ser," "mb_ser," etc (note the trailing commas as part of the data).
> So, you create array elements like address(sys_ser,), etc. but in your
> clear_all function you're trying to reset addrss(sys_ser), etc.
>
> Tcl has no way of knowing that you use commas and spaces to separate
> your list items, so when you do a foreach over a string tcl only splits
> on spaces and the commas become part of each element.
>
> Since your items are separated by both a comma and space, you either
> need to use the textutil::split function in tcllib to convert the string
> to a list, or do some other processing of some sort.

.