Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Perl Tk Gang together two Scrolled Panes

by zentara (Archbishop)
on Nov 29, 2018 at 14:48 UTC ( #1226502=note: print w/replies, xml ) Need Help??


in reply to Perl Tk Gang together two Scrolled Panes

It might help if you removed the line numbers from your code example, so others can try running your code without too much editing.

I'm not really a human, but I play one on earth. ..... an animated JAPH
  • Comment on Re: Perl Tk Gang together two Scrolled Panes

Replies are listed 'Best First'.
Re^2: Perl Tk Gang together two Scrolled Panes
by ashervin (Novice) on Nov 29, 2018 at 14:59 UTC
    #!/usr/bin/perl -- use warnings; use strict; use Tk; require Tk::Pane; my $mw = MainWindow->new(); $mw->geometry("1400x900"); #my $mainFrame = $mw->Frame(); my $headFrame = $mw->Scrolled('Pane', -scrollbars => 'se', -height=>30, -width=>1300, -bg=>'orange')->grid( -row => 0, -column => 0); my $dataFrame = $mw->Scrolled('Pane', -scrollbars => 'se', -height=>700, -width=>1300, -bg=>'gray')->grid( -row => 4, -column => 0); my $horiz = $dataFrame->Subwidget('xscrollbar'); $horiz->configure(-command => sub { $dataFrame->xview(@_); $dataFrame->xview(@_) }); open my $dataFH, "<", $ARGV[0] or die "Could not open $ARGV[0]"; my $row = 0; my $hRow = 0; while(!eof $dataFH) { my $data=readline($dataFH); my @dataArr = split '\|', $data; my $column = 0; my $bg='gray'; if($dataArr[0] =~ m/^Record/) { $bg='orange'; foreach my $field (@dataArr) { my $label = $headFrame->Label(-height=>2, -bg=>$bg, -fg=>'black', -text => $field, -relief => 'ridge'); $label->grid( -sticky=> 'ew', -row => $hRow, -column => $column++); } $hRow++; } else { foreach my $field (@dataArr) { my $label = $dataFrame->Label(-height=>2, -bg=>$bg, -fg=>'black', -text => $field, -relief => 'ridge'); $label->grid( -sticky=> 'ew', -row => $row, -column => $column++); } $row += 1; } } $mw->idletasks; my ($columns, $rows) = $dataFrame->gridSize(); my $cnt=0; while($cnt < $columns) { my ($arg1, $arg2, $width, $arg4) = $dataFrame->gridBbox($cnt, 4); my( $arg1a, $arg2a, $hWidth, $arg4a) = $headFrame->gridBbox($cnt, 0); if($hWidth > $width) { $dataFrame->gridColumnconfigure($cnt, -minsize=>$hWidth); } else { $headFrame->gridColumnconfigure($cnt, -minsize=>$width); } $cnt++; } $mw->MainLoop;

      Here is some data.

      Record 0|HeaderRegion|HeaderLpar|HeaderDate|ApplInd|FileType

      Record1|Entity|XXXXXXXNumber|XXXXXXXXXXType|XXXXXXXXXCd|Initiator|XXXXXXXXXCd|XXXXXXXXXAmt|XXXXXCd|XXXXXXXXXXXCd|XXXXLimit|XXXXLimit|XXXXXXXXXInd|XXXXXXCd|TimeZone|Year|Month|Day|Hour|Minutes|Seconds|NanoSeconds|BassRsnCd|MachineIdType|MachineId|UserIdType|UserId

      Record 8|EntityCode|TotalDetailRecordCount

      Record 9|RecordCount

      0|NE|9U|20180705|CPUU |

      1|00001|00000077295245|QF|125 |D|O|.0| | |.0|.0| | |DUV|2018|08|07|11|21|56|000000| | | |XXX|XXXXXXX

      1|00001|00237026981728|QF|125 |D|O|.0| | |.0|.0| | |DUV|2018|08|07|12|00|11|000000| | | |XXX|XXXXXXX

      1|00001|00002370951778|QF|125 |D|O|.0| | |.0|.0| | |DUV|2018|08|08|13|09|10|000000| | | |XXX|XXXXXXX

      1|00001|00237028512150|QF|125 |D|O|.0| | |.0|.0| | |DUV|2018|08|08|13|10|37|000000| | | |XXX|XXXXXXX

      1|00001|00237995669646|QF|264 |D|O|.0| | |.0|.0| | |DUV|2018|08|08|14|33|40|000000| | | |XXX|XXXXXXX

      1|00001|00000686096496|QF|125 |D|P|.0| | |.0|.0| | |DUV|2018|08|10|14|33|01|000000| |OC|XXXXXXX | |

      1|00001|00237002888298|QF|300 |D|O|.0| | |.0|.0| | |DUV|2018|08|23|17|19|33|000000| | | |XXX|XXXXXXX

      8|00001|0000000007

      9|0000000070

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1226502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2019-10-24 02:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?