in reply to Perl/Tk, how to make the black border not to appear around the Tree widget

...its always nice to give a complete, minimal running example, so we can run your code without having to flesh it out ourselves....but i see the problem

...i think you have a focus problem.... read perldoc Tk::focus....

if your main concern is stopping this normal widget behavior, for asthetic reasons, you might want to make your own custom widget that responds exactly the way you want

... some Tk widgets are so locked into this type of behavior, that the only way around it is to match colors for the highlight and select modes, so it appears invisible

....the first thing i would try, is to but in a -browsecmd callback in your tree, and in that callback force the focus back to the mainwindow, like

-browsecmd => sub{ $mw->focus }
or some dynamic hack that keeps the focus elsewhere..... but then again ,it might break the way the widget works..... back to making your own widgets :-)

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku
  • Comment on Re: Perl/Tk, how to make the black border not to appear around the Tree widget
  • Download Code

Replies are listed 'Best First'.
Re^2: Perl/Tk, how to make the black border not to appear around the Tree widget
by Anonymous Monk on Nov 10, 2009 at 18:44 UTC

    Thank you much for the reply, Zentara,

    >...its always nice to give a complete, minimal running example, so we can run your code without having to flesh it out ourselves
    It's all deep inside different loops, with multiple hash keys and array indexes. But OK, you're right. Next time I'll do it, anyway...

    After adding your browsecmd, the black border appears for a moment and then goes. Thanks a lot, you have shown me the main problem!

    Yes, I have only asthetic reasons... And yes, I checked, 'highlight' option changes the color of the border. So, I miss only the right color name for my background (the default like silver?).

    Thank you again!

      hi...each widget in Tk seems to respond to a different set of options.... its a haphazrd collection of options.... so here is another little secret

      read perldoc Tk::options and see the other options available ( that the Tree author didn't put in his docs).... there is an option for "highlightthickness".... you might see if that works, put a value for 0 or 1 in there and see if it helps.

      ...as to the other trick, about matching colors...in Tk::options there are some options for background and highlightbackground colors..... they may not respond to the Tree though....that is the trouble with Tk.....it's not a coherent widget set and inherited object system...... next project, think Gtk2


      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku