in reply to PerlTk; text justification in an hlist

"justify" does not seem to be a valid method for the hlist or it's items?
That's because it's not a method. The docs say it's an option. See Tk::Ditem for more info.

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

  • Comment on Re: PerlTk; text justification in an hlist

Replies are listed 'Best First'.
Re: Re: PerlTk; text justification in an hlist
by Anonymous Monk on Jan 29, 2004 at 21:27 UTC
    You are correct, I'm looking for an option not a method. However, I still have a problem...I cannot see a "justify" option for hlist. Can you?
      perldoc Tk::HList says
      Each list entry in an HList widget is associated with a display item. The display item determines what visual information should be displayed for this list entry. Please see the Tk::DItem manpage for a list of all display items. When a list entry is created by the itemCreate, add or addchild widget methods, the type of its display item is determined by the -itemtype option passed to these methods. If the -itemtype is omitted, then by default the type specified by this HList widget's -itemtype option is used.
      Now go read the Tk::DItem docs.
      http://perltk.org/ptknews/search.cgi?Search=justify
      Re: How do you justify the contents of an HList column?

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

        Thaks for your help. The following worked for me: Note this is only the relevant part of the code.
        use Tk::ItemStyle; # use itemstyle # define the simple styles my $rj = $hlist->ItemStyle("text", -justify => 'right'); my $cj = $hlist->ItemStyle("text", -justify => 'center'); # when calling itemCreate use a style $hlist->itemCreate($job, $option++, -text => $cpu{$job}, -itemtype => +'text', -style => $rj);