in reply to Re: Textview format, help please !
in thread Textview format, help please !

Hi, thanks for the reply. I gave Text::Table a go, but I still end up with output that looks like this:
1 SA STRIP+ASSEMBLE 1 122.00 2 LOS LABOUR ON PARTS SUPPLY 1 1200.00 3 FBS FAN BLADE SUPPLY 1 1200.00
I just used
my $tb = Text::Table->new(); $tb->add($linenum,$kode,$waarde,$entry_qty,$entry_price);
Can you give me some examples how to use the 'align =>' and/or is_sep functions?

Replies are listed 'Best First'.
Re^3: Textview format, help please !
by Khen1950fx (Canon) on Jul 22, 2010 at 11:01 UTC
    Maybe you've had a long day, but I gave Text::Table a try and got good results. Try this:
    #!/usr/bin/perl use strict; use warnings; use Text::Table; my $tb = Text::Table->new( "ID", "DESCRIPTION", "QTY", "PRICE" ); $tb->load( [ "1 los", "LABOR ON PARTS", 1, '760.00' ], [ "2 sa", "STRIP", 1, '450.00' ], [ "3 av", "VALUE", 1, '2000.00' ], ); print $tb;
      That works, partially, the problem is it prints out the table as it should be in the cmd window, but the same text in the textview are scrambled :(

        peokai:

        I don't use Tk, Glade, Gtk, et. al., so this is just a wild guess. You've probably already considered this, but just on the chance that you didn't: Are you using a proportional font in our text window? A proportional font causes just the symptom you're describing because each letter may have a different width on the screen. Using a monospaced font (Courier, for instance) would fix the problem if that's the case.

        ...roboticus

Re^3: Textview format, help please !
by moritz (Cardinal) on Jul 22, 2010 at 11:37 UTC
    Maybe your problem is that you want to display ASCII art with a proportional font?

    Try to use a monospace font instead, then all the columns should align neatly.