Desperately need help with HLists 
Author Message
 Desperately need help with HLists

i'm trying to place frames inside an HList, but the frames don't take
up the whole width of the item.  how can i make them do this?  any
help at ALL would be appreciated.

thanks, here's the code:

use Tk;

$mw = MainWindow->new(-width => 360);
$lab_orig = $mw->Label(-text => "test")->pack(-expand => 1, -fill =>
'both');
$list = $mw->HList(-background => "white", -itemtype =>
'window')->pack(-expand => 1, -fill => 'both');
$frame = $list->Frame;
$list->add("Buddies", -widget => $frame);

$lab = $frame->Label(-text => "teer")->pack(-side => 'left', -fill =>
'both', -expand => 1);

$mw->update;
$list->update;
$frame->configure(-width => $list->width());

print $list->width;

MainLoop;



Sat, 26 Mar 2005 08:13:02 GMT  
 Desperately need help with HLists
All right, then -- here's some help. My first piece of advice would be to not
use HList for embedding widgets. I've generally found the end result to be less
than what I'd hoped. There a few flaws in how it handles embedded widgets -
enough to make me wonder if it's really worth it.  Having said that here is one
workaround that might help a bit:

(even with this though.. I noticed some unpleasant
behavior. Drag your mouse right across the HList and watch the display item
moved across the widgets border -- ugly, eh?)

use Tk;
use Tk::HList;

$mw = MainWindow->new(-width => 360);

$lab_orig = $mw->Label(-text => "test")->
   pack(qw/ -expand 1 -fill both/);

$list = $mw->HList(
   -background => "white",
   -itemtype => 'window',
)->pack(qw/-expand 1 -fill both/);

$list->configure(-sizecmd => [\&updateWidth, $list]);

$frame = $list->Frame;
$list->add("Buddies", -itemtype => 'window', -widget => $frame);

$lab = $frame->Label(
   -text => "teer",
   -anchor => 'w'
)->pack(qw/-side left -fill both -expand 1/);

MainLoop;

sub updateWidth {
  my $list = shift;
  my $padx = 4;
  my $offset = ($list->cget(-borderwith) * 2) +
                     ($list->cget(-highlightthickness) * 2) +
                      $padx;
  $list->columnWidth(0, ($list->width() - $offset));

Quote:
}

Rob


Sat, 26 Mar 2005 11:59:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. need DBM help desperately!

2. Desperately need help on installing GD.pm

3. Desperately need help with Image::Magick

4. desperately needing help

5. Need Help with HList!

6. Need help with HList

7. Help needed:Configuring Individual Enties in HList

8. NEED PERL EXPERTISE, DESPERATELY!

9. Password script needed desperately.

10. Perl advice desperately needed.....

11. Need Perl (4.0 or higher) binaries desperately for Xenix System V

12. Seeking help with MakeMaker desperately

 

 
Powered by phpBB® Forum Software