For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > June 2004 > Problem with adding entries with periods in HList?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with adding entries with periods in HList?
dsyu@opposite-of-cold-mail.com

2004-06-16, 3:59 am

Can anyone clue me into why "line2" in the following cannot be added
as a line in a Tk HList? I get:

parent element "This . is . another . line" does not exist at
/usr/local/lib/perl5/site_perl/5.6.1/i686-linux/Tk.pm line 228.

It seems like any string containing a "." cannot
be added as an entry? But I'm unclear as to why that is. I could add
it by specifying the path as '' instead of $line2, but then the line
is
not selectable.

Thanks in advance.

-- Dan

-----
#!/usr/local/bin/perl -w

# Silly TK test example using HList
#

use Tk;
use Tk::DialogBox;
use Tk::Tree;
use Tk::BrowseEntry;

main();

sub main {
my $main_window;
my $hlist;

my $line1 = "This is a line";
my $line2 = "This . is . another . line.";

$main_window = MainWindow->new();
$main_window->title( "Blah" );
$main_window->geometry( "510x400+40+40" );
$hlist =
$main_window->Scrolled(
"HList",
"width" => 20,
"height" => 20,
"background" => "#EFEFEF",
"selectbackground" => "#C0C0FF",
"selectmode" => "extended",
"relief" => "groove",
-scrollbars => "osoe"
)->place(
-x => 120,
-y => 75
);

$hlist->add( $line1, -text => $line1 );
$hlist->add( $line2, -text => $line2 );
MainLoop();
}
-----
Marc Dashevsky

2004-06-16, 3:59 am

In article <ba0c1848.0406151736.7bcfcaaa@posting.google.com>, danhoo@gmail.com says...
> Can anyone clue me into why "line2" in the following cannot be added
> as a line in a Tk HList? I get:
>
> parent element "This . is . another . line" does not exist at
> /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/Tk.pm line 228.
>
> It seems like any string containing a "." cannot
> be added as an entry? But I'm unclear as to why that is. I could add
> it by specifying the path as '' instead of $line2, but then the line
> is not selectable.


From the Tk::HList pod:

Name: separator
Class: Separator
Switch: -separator

Specifies the character to used as the separator character
when intepreting the path-names of list entries. By default
the character "." is used.

> Thanks in advance.
>
> -- Dan
>
> -----
> #!/usr/local/bin/perl -w
>
> # Silly TK test example using HList
> #
>
> use Tk;
> use Tk::DialogBox;
> use Tk::Tree;
> use Tk::BrowseEntry;
>
> main();
>
> sub main {
> my $main_window;
> my $hlist;
>
> my $line1 = "This is a line";
> my $line2 = "This . is . another . line.";
>
> $main_window = MainWindow->new();
> $main_window->title( "Blah" );
> $main_window->geometry( "510x400+40+40" );
> $hlist =
> $main_window->Scrolled(
> "HList",
> "width" => 20,
> "height" => 20,
> "background" => "#EFEFEF",
> "selectbackground" => "#C0C0FF",
> "selectmode" => "extended",
> "relief" => "groove",
> -scrollbars => "osoe"
> )->place(
> -x => 120,
> -y => 75
> );
>
> $hlist->add( $line1, -text => $line1 );
> $hlist->add( $line2, -text => $line2 );
> MainLoop();
> }
> -----
>


--
Go to http://MarcDashevsky.com to send me e-mail.
dsyu@opposite-of-cold-mail.com

2004-06-16, 8:57 pm

Marc Dashevsky <usenet@MarcDashevsky.com> wrote in message news:<MPG.1b3972381717114b98997c@netnews.comcast.net>...
>
> From the Tk::HList pod:
>
> Name: separator
> Class: Separator
> Switch: -separator
>
> Specifies the character to used as the separator character
> when intepreting the path-names of list entries. By default
> the character "." is used.
>

That's it! Thanks Marc!

-- Dan
dsyu@opposite-of-cold-mail.com

2004-06-16, 8:57 pm

Marc Dashevsky <usenet@MarcDashevsky.com> wrote in message news:<MPG.1b3972381717114b98997c@netnews.comcast.net>...
>
> From the Tk::HList pod:
>
> Name: separator
> Class: Separator
> Switch: -separator
>
> Specifies the character to used as the separator character
> when intepreting the path-names of list entries. By default
> the character "." is used.
>

That's it! Thanks Marc!

-- Dan
dsyu@opposite-of-cold-mail.com

2004-06-17, 3:56 am

Marc Dashevsky <usenet@MarcDashevsky.com> wrote in message news:<MPG.1b3972381717114b98997c@netnews.comcast.net>...
> From the Tk::HList pod:
>
> Name: separator
> Class: Separator
> Switch: -separator
>
> Specifies the character to used as the separator character
> when intepreting the path-names of list entries. By default
> the character "." is used.
>


Thanks Marc, that's it!

-- Dan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com