[R-gui] tk2mclistbox problem

Christiane Raemsch Christiane.Raemsch at imbe.med.uni-erlangen.de
Fri Dec 11 10:12:08 CET 2009


Philippe Grosjean schrieb:
> Mark Heckmann wrote:
>> Hey Philippe,
>>
>> I have a question concerning an tk2mclistbox problem.
>> I have the same problem as in this post you commented.
>>
>> https://stat.ethz.ch/pipermail/r-sig-gui/2009-February/000911.html
>>
>> It was dated Feb.09. The sample code still throws an error.
>> Are there any advances? Right now it seems the tk2mclistbox cannot 
>> be  used?!
>
> 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
>
>> Am I wrong? What can I do?
>>
>> Thanks in advance!!
>>
>> Mark
>>
>> –––––––––––––––––––––––––––––––––––––––
>> Mark Heckmann
>> Dipl. Wirt.-Ing. cand. Psych.
>> Vorstraße 93 B01
>> 28359 Bremen
>> Blog: www.markheckmann.de
>> R-Blog: http://ryouready.wordpress.com
>>
>>
>>
>>
>>
>>     [[alternative HTML version deleted]]
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> R-SIG-GUI mailing list
>> R-SIG-GUI at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>
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



More information about the R-SIG-GUI mailing list