Skip to content
Prev 1002 / 1236 Next

[R-gui] tk2mclistbox problem

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