in reply to editable text + syntax for addTextFramePage
That's not nice :) you're not supposed to edit modules directly. You're supposed to copy _text_frame and change it to suit your needs, one way
the other way is monkeypatching (declaring a subroutine in someone elses package)$wizard->addPage( sub { MyTextFrame( $wiz ); } ); ... sub MyTextFrame { package Tk::Wizard; ## for DEBUG/WARN/Dumper... my $self = shift; my $args = shift; DEBUG "Enter _text_frame with ", Dumper($args); my $text; my $frame = $self->blank_frame(%$args); if ( $args->{-boxedtext} ) { if ( ref $args->{-boxedtext} eq 'SCALAR' ) { $text = $args->{-boxedtext}; } elsif ( not ref $args->{-boxedtext} ) { open my $in, $args->{-boxedtext} or Carp::croak "Could not read file: $args->{-boxedtex +t}; $!"; read $in, $$text, -s $in; close $in; WARN "Boxedtext file $args->{-boxedtext} is empty." if not + length $text; } } $$text = "" if not defined $text; my $t = $frame->Scrolled( "TextHighlight", -syntax => ( $args->{ -syntax } || 'Perl' ), -background => ( $args->{ -background } || 'white' ), -relief => "sunken", -borderwidth => "1", -font => $self->{defaultFont}, -scrollbars => "osoe", -wrap => "word", )->pack(qw/-expand 1 -fill both -padx 10 -pady 10/); $t->configure( -background => 'green' ) if DEBUG_FRAME; $t->insert( '0.0', $$text ); ## $t->configure( -state => "disabled" ); return $frame; }
$wizard->addPage( sub { $wiz->MyTextFrame; } ); sub Tk::Wizard::MyTextFrame { ...
Can't edit though, and not sure if this breaks something else. Same happens with Tx::CodeText
When a widget is diabled, its disabled :) Remove
This disabled bit from sub _text_frame looks like a bug in Tk::Wizard, it doesn't make sense to disable ROText, its already read-only :)$t->configure( -state => "disabled" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: editable text + syntax for addTextFramePage
by rgcosma (Beadle) on May 05, 2011 at 08:17 UTC |