kgnickl has asked for the wisdom of the Perl Monks concerning the following question:

How would I position the Cancel button in my tk DialogBox? By default it is in the bottom and centered. I want it on the bottom and to the right. I read its in a ?widget/frame? called bottom, but I'm not sure how what code to write to get that widget/frame then style/position the button. Thanks! I copied my code below for the dialogbox:

my $dialog = $mw->DialogBox(-title => 'My Dialogue Box!',-buttons =>[' +Continue']); $dialog->geometry( "400x200" ); #WIDTH x HEIGHT $dialog->resizable( 0, 0 ); #(0, 0) means not resizable bottom->Frame(-relief=>'ridge', -border=>1)->pack(-fill => 'x', -padx= +> 0, -pady=> 0); $dialog->protocol('WM_DELETE_WINDOW',sub{return;}); my $topDialog_frame = $dialog->Frame(-relief=>'ridge', -border=>1)->pa +ck(-fill => 'x', -padx=> 0, -pady=> 0); my $middleDialog_frame = $dialog->Frame(-relief=>'ridge', -border=>1)- +>pack(-fill => 'x', -padx=> 0, -pady=> 0); $topDialog_frame->Label(-text=>'Test 1',-font=>'Helvetica 9 bold')->pa +ck(-anchor=> 'w', -ipadx=> 3, -ipady=> 3,); $middleDialog_frame->Label(-text=>'Test 2',-font=>'Helvetica 9 bold')- +>pack(-anchor=> 'w', -ipadx=> 3, -ipady=> 3,); my $item = $dialog->Show();

Replies are listed 'Best First'.
Re: Poition tk DialogBox button?
by Anonymous Monk on Apr 22, 2011 at 00:39 UTC
Re: Poition tk DialogBox button?
by zentara (Cardinal) on Apr 22, 2011 at 17:48 UTC
    If you would post a complete working example, maybe one of us could show you your packing error, but to ask us to flesh out your code fragment, is too much.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Poition tk DialogBox button?
by lamprecht (Friar) on Apr 22, 2011 at 22:09 UTC
    my $bframe = $dialog->Subwidget('bottom'); for ($bframe->children) { $_->packForget; $_->pack(-side => 'right', -padx => 3, -pady => 3, ) }
    Cheers, Christoph