Skip to content

[R-gui] tk2mclistbox problem

4 messages · Mark Heckmann, Philippe GROSJEAN, Christiane Raemsch

#
Mark Heckmann wrote:
I tried to fix the problem, but it appears to be a bug in a Tk widget 
that is not maintained any more (mclistbox). At the time I integrated it 
in tcltk2, it was fully functional. At this point, there are three 
possibilities:

1) To use a Tktable widget instead (also supported by tcltk2),

2) To use the newer tablelist Tk widget, but that requires some work to 
incorporate it in tcltk2 (http://wiki.tcl.tk/5527; the best choice I think),

3) To fix the old mclistbox widget (we need a good Tcl programmer here).

If someone wants to submit a patch for #3, or work on a solution for #2, 
I will gladly include it in tcltk2.
Best,

Philippe Grosjean
4 days later
#
Philippe Grosjean schrieb:
I also had this problem.
I found out that the error occurs in the tcl procedure 
'::tk::ListboxBeginSelect', so i rewrite it (removing the part where the 
error occurs, which was only an additional condition here *).

Run the following in R before creating the listbox:

string = 'proc ::tk::ListboxBeginSelect {w el {focus 1}} {
                                    variable ::tk::Priv
                                    if {[$w cget -selectmode] eq 
"multiple"} {
                                    if {[$w selection includes $el]} {
                                        $w selection clear $el
                                    } else {
                                        $w selection set $el
                                    }
                                    } else {
                                    $w selection clear 0 end
                                    $w selection set $el
                                    $w selection anchor $el
                                    set Priv(listboxSelection) {}
                                    set Priv(listboxPrev) $el
                                    }
                                    event generate $w <<ListboxSelect>>
                                    if {$focus && [winfo exists $w] *} 
{                     
                                    focus $w
                                    }
                                }'
                               
.Tcl(string)

I am not a skilled tcl programmer,  it was only an experiment and for me 
it worked good.
Maybe it also helps you.

Best Regards,
C.R?msch
1 day later
#
Many thanks! Added to tcltk2 1.1-1 (in a slightly different form). It 
should shortly appear on CRAN.
Best,

PhG
Christiane Raemsch wrote: