The code below is the smallest example I could come up with.
There are two curiosities that I'd like to figure-out.
- When I double-click (left-mouse-button), a small dashed box appears around the entry that's been clicked
- When I double-click (left-mouse-button), the entry changes color from green to black (still with Courier 12 bold)
When I single (left-click) the window not containing an entry, then the entry that was clicked returns to being displayed as DarkGreen with no highlight box round it.
Questions (somewhat inter-related):
- Is it possible to disable HList from responding to the double-left-click (so that the entry doesn't get a dashed-box and the color of the entry doesn't change)?
- On other GUIs I've written, the dashed-box has proved annoying. Is it possible to prevent the dashed-box from appearing?
Thank you for your time.
#!/usr/bin/perl
use Tk;
use Tk::HList;
use Tk::ItemStyle;
use File::Basename;
$FONT_BOLD = "Courier 12 bold";
$mw = MainWindow->new(-title => $0);
$hlist = $mw->HList(-selectmode=>"none",
-selectbackground=>"Wheat",
-selectborderwidth=>0,
-background=>"Wheat",
-selectbackground=>"Wheat",
-separator=>"/",
-drawbranch=>1,
-indicator=>1,
) -> pack(qw/-fill both -expand yes/);
$Highlight = $mw->ItemStyle('text', -foreground=>"DarkGreen", -backgro
+und=>"Wheat", -font=>$FONT_BOLD);
foreach $path("/", "/home", "/home/andrew")
{ $hlist -> add($path, -text=>basename($path), -style=>$Highlight);
}
MainLoop();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.