[EMAIL PROTECTED] (Vadim Konovalov) writes:
>> I tried a simple code to access Tk through Tcl extension but get the
>> following errors.
...
> This is because Tk::Pane is not ported to Tcl::Tk, however porting it is
> easy.
>
> Looking at "perldoc Tk::Pane" I see that it is very close to a widget named
> "ScrollableFrame" within BWidgets
> (and Tk::Panedwindow is very close to PanedWindow within same BWidgets)
>
> To introduce 'Pane' widgets which refers to 'ScrollableFrame' you need only
> one single line of code:
>
> $mw->Declare('Pane','ScrollableFrame',-require=>'BWidget');
> So your code becomes:
> ========
> use Tcl::Tk qw/:perlTk/;
>
> use warnings;
> use strict;
> my ($mw,$pane_fr);
> $mw = MainWindow->new();
> $mw->geometry("300x100");
>
> $mw->Declare('Pane','ScrollableFrame',-require=>'BWidget');
>
> $pane_fr = $mw->Scrolled('Pane',-scrollbars=>'osoe')->pack(-fill=>'both',
> -expand=>1,
> );
> MainLoop;
> ===========
>
> However, if actual usage of Tk::Pane is different, a bit more coding is
> required to support Tk::Pane better (however that code is quite quick to do)
>
> We can add support of Tk::Pane widget directly to Tcl::Tk, if that sounds
> reasonable.
>
> Also, it is currently a limitation that 'Scrolled' now always overrides
> -scrollbars option with 'osoe'; let us know if this is a problem.
I don't know Tcl, this was kind of attempt to find how easy/difficult
it is to access Tk/Tcl library through Tcl::Tk and also to find
a workaround when Tk::Text module with Perl 5.8.7 fails to work
(non ascii characters are distorted).
When I added another chunk of code to my original snippet, I had to disable
sticky option in the Scrolled method because of Tcl error 'unknown option
"-sticky" at ...'
Another error was Tcl error 'invalid command name "ScrollableFrame::ToolBar"
at ...'.
I suppose there is no support for Tk::ToolBar in Tcl::Tk as well.
Regarding overriding -scrollbars option I'm not sure if there's anything
similar in ScrollbarFrame, I'd like to have scrollbars optional.
--
Radek