For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > January 2007 > Error Message on console while using Spreadsheet









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 Error Message on console while using Spreadsheet
Joy

2007-01-14, 4:06 am

Hi All,
When I select any row and press "Enter", I get following error
message on the console.

Tk::Error: no "anchor" cell in table at

/home/multi-perl/bin/../lib/site_perl/5.8.3/i686-linux-thread-multi/Tk.pm
line 247.
Tk callback for .frame1.frame.spreadsheet
Tk callback for .frame1.frame.spreadsheet
Tk::__ANON__ at

/home/multi-perl/bin/../lib/site_perl/5.8.3/i686-linux-thread-multi/Tk.pm
line 247
Tk::TableMatrix::Spreadsheet::MoveCell at
/home/site_perl/5.8.3/i686-linux-thread-multi/Tk/TableMatrix/Spreadsheet.pm
line 556
<Key-Return>
(command bound to event)

Here is my sample code.

use Tk;
use Tk::TableMatrix::Spreadsheet;
$mw = MainWindow->new;
$mw->configure(-title=>'Testing');
$mw->minsize(qw(500 200));
$menu = $mw->Frame()->pack(-side=>'top',-fill=>'x');
$menu_file =
$menu->Menubutton(-text=>'File',-tearoff=>'false')->pack(-side=>'left');
$menu_file->command(-label=>'Exit',-command=>sub{$mw->destroy});
$frame =
$mw->Frame(-height=>'10',-width=>'30',-relief=>'groove',-borderwidth=>'3')->pack(-fill=>'x',-pady=>'0');

@border = (0,0,0,1);

$arrayVar->{"0,0"} = "%";
$arrayVar->{"0,1"} = "Artist";
$arrayVar->{"0,2"} = "Album";
$arrayVar->{"0,3"} = "Year";
$arrayVar->{"0,4"} = "Genre";
$table = $frame->Scrolled('Spreadsheet',
-cols => 25,
-width => 5, -height => 6,
-titlerows => 1,
-variable => $arrayVar,
-selectmode => 'multiple',
-selecttype => 'row',
-resizeborders => 'col',
-bg => 'white',
-rowheight => 2,
-bd => \@border,
-justify => 'left',
-drawmode => 'compatible',
-wrap => 0,
-relief => 'solid'
)->pack(-fill=>'both');
$table->rowHeight(0,1);
$table->tagRow('title',0);
$table->tagConfigure('title', -bd=>2, -relief=>'raised');
$table->colWidth(0,5,3,6,4,10);
MainLoop();
1;


Please let me know how can I overcome this problem....

Thanks,
Joy

smallpond@juno.com

2007-01-15, 7:03 pm

Joy wrote:
> Hi All,
> When I select any row and press "Enter", I get following error
> message on the console.
>
> Tk::Error: no "anchor" cell in table at
>
> /home/multi-perl/bin/../lib/site_perl/5.8.3/i686-linux-thread-multi/Tk.pm
> line 247.
> Tk callback for .frame1.frame.spreadsheet
> Tk callback for .frame1.frame.spreadsheet
> Tk::__ANON__ at
>
> /home/multi-perl/bin/../lib/site_perl/5.8.3/i686-linux-thread-multi/Tk.pm
> line 247
> Tk::TableMatrix::Spreadsheet::MoveCell at
> /home/site_perl/5.8.3/i686-linux-thread-multi/Tk/TableMatrix/Spreadsheet.pm
> line 556
> <Key-Return>
> (command bound to event)
>
> Here is my sample code.
>
> use Tk;
> use Tk::TableMatrix::Spreadsheet;
> $mw = MainWindow->new;
> $mw->configure(-title=>'Testing');
> $mw->minsize(qw(500 200));
> $menu = $mw->Frame()->pack(-side=>'top',-fill=>'x');
> $menu_file =
> $menu->Menubutton(-text=>'File',-tearoff=>'false')->pack(-side=>'left');
> $menu_file->command(-label=>'Exit',-command=>sub{$mw->destroy});
> $frame =
> $mw->Frame(-height=>'10',-width=>'30',-relief=>'groove',-borderwidth=>'3')->pack(-fill=>'x',-pady=>'0');
>
> @border = (0,0,0,1);
>
> $arrayVar->{"0,0"} = "%";
> $arrayVar->{"0,1"} = "Artist";
> $arrayVar->{"0,2"} = "Album";
> $arrayVar->{"0,3"} = "Year";
> $arrayVar->{"0,4"} = "Genre";
> $table = $frame->Scrolled('Spreadsheet',
> -cols => 25,
> -width => 5, -height => 6,
> -titlerows => 1,
> -variable => $arrayVar,
> -selectmode => 'multiple',
> -selecttype => 'row',
> -resizeborders => 'col',
> -bg => 'white',
> -rowheight => 2,
> -bd => \@border,
> -justify => 'left',
> -drawmode => 'compatible',
> -wrap => 0,
> -relief => 'solid'
> )->pack(-fill=>'both');
> $table->rowHeight(0,1);
> $table->tagRow('title',0);
> $table->tagConfigure('title', -bd=>2, -relief=>'raised');
> $table->colWidth(0,5,3,6,4,10);
> MainLoop();
> 1;
>
>
> Please let me know how can I overcome this problem....
>
> Thanks,
> Joy


When creating $table
-rows => ??

-- S

Joy

2007-01-16, 4:03 am



On Jan 16, 12:41 am, smallp...@juno.com wrote:
> Joy wrote:
>
>
>
>
>
>
>
>
>
> -rows => ??
>
> -- S


I have tested with -rows=>100, but still getting the problem.

smallpond@juno.com

2007-01-16, 7:03 pm


Joy wrote:
> On Jan 16, 12:41 am, smallp...@juno.com wrote:
>
> I have tested with -rows=>100, but still getting the problem.



Looks like the module has a lot of default bindings for keys. What do
you expect to happen when you hit return?
--S

Joy

2007-01-17, 8:03 am


I just want to remove the error messages. I am doing nothing on
pressing Enter button.
-Joy

On Jan 16, 10:23 pm, smallp...@juno.com wrote:
> Joy wrote:
>
>
>
>
>
>
>
>
>
>
>
> you expect to happen when you hit return?
> --S


smallpond@juno.com

2007-01-17, 7:01 pm



> On Jan 16, 10:23 pm, smallp...@juno.com wrote:

Joy wrote:[color=darkred]
> I just want to remove the error messages. I am doing nothing on
> pressing Enter button.
> -Joy
>


If you don't care what it does, then just define the undefined value,
which is "anchor". Add this line just before calling MainLoop:

$table->selectionAnchor('topleft');

According to the doc, the Enter key (or the Return key, as oldtimers
call it) "causes the the current cell to move down". I suppose it
wants
a selection anchor to know what the "current cell" is.

--S

Joy

2007-01-17, 7:01 pm


Thanks for you help.

On Jan 17, 7:35 pm, smallp...@juno.com wrote:
>
>
>
>
>
>
>
>
>
>
>
> Joy wrote:
> which is "anchor". Add this line just before calling MainLoop:
>
> $table->selectionAnchor('topleft');
>
> According to the doc, the Enter key (or the Return key, as oldtimers
> call it) "causes the the current cell to move down". I suppose it
> wants
> a selection anchor to know what the "current cell" is.
>
> --S


Sponsored Links







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

Copyright 2008 codecomments.com