logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Aligning a button to the right in a BoxSizer: msg#00064

Subject: Re: Aligning a button to the right in a BoxSizer

On Oct 23, 2005, at 10:36 PM, Foo Ji-Haw wrote:

Hello all,
 
I am trying to create a nested BoxSizer-in-a-BoxSizer. Outer sizer is vertical, inner sizer is horizontal.
 
In the horizontal sizer, I have a single button in a row which I want to align to the RIGHT. This is my code:
 my $sizer = Wx::BoxSizer->new(wxVERTICAL);
 $this->SetSizer($sizer);
...
 my $ButtonSizer = Wx::BoxSizer->new(wxHORIZONTAL);
 $sizer->Add($ButtonSizer,0,wxGROW);
 
 my $btnClose = Wx::Button->new($this,-1,'C&lose');
 $ButtonSizer->Add($btnClose,1,wxALL|wxALIGN_RIGHT,5);
...
 $sizer->SetSizeHints( $this );
 $this->SetAutoLayout(1);
The button keeps staying on the left. Can someone enligthen me on this? Thanks.


Try changing the order to 
    $ButtonSizer->Add($btnClose, ...); 
    $sizer->Add($ButtonSizer, ...); 
    $this->SetSizer($sizer);

Regards,
John Ralls


Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>