<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Re: [wxruby-users] Problem centering a label</title>
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EstiloDeEmail18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=PT-BR link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Christian :<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I say in the other mail &#8220;I have a frame&#8221;,  brong  i
have a panel.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The panel is inside the main frame.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I change my code to :<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>class TarefasNova &lt; Wx::Panel<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>    def initialize(parent)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        rect = parent.get_client_rect();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        super( parent, 1011, Wx::Point.new( 0, 0 ),
rect.get_size(),<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>              SIMPLE_BORDER,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>              &quot;NovaTarefa&quot; );<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        #sizer = Wx::BoxSizer.new(Wx::VERTICAL)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        box   = Wx::BoxSizer.new(Wx::HORIZONTAL);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        box.add_stretch_spacer();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        box.add Wx::StaticText.new(self, -1, 'asdf'), 0, 1<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        #label = Wx::StaticText.new( self, :label =&gt;
&quot;CADASTRO DE TAREFAS (NOVA)&quot;, :size =&gt; [250,-1] );<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        #box.add( label, 1, Wx::ALIGN_CENTER, 5);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        box.add_stretch_spacer();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>        #sizer.add_item(box, 0, Wx::ALIGN_CENTER|Wx::ALL, 5);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>    end<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>end<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>But the text is not centered, the text is in the left.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Exist some diferences between frame and panel to user sizer? <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
wxruby-users-bounces@rubyforge.org [mailto:wxruby-users-bounces@rubyforge.org] <b>Em
nome de </b>Christian Schmidt<br>
<b>Enviada em:</b> quinta-feira, 19 de março de 2009 19:49<br>
<b>Para:</b> wxruby-users@rubyforge.org<br>
<b>Assunto:</b> Re: [wxruby-users] Problem centering a label<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p><span style='font-size:10.0pt'>Hi Alejandro,<br>
<br>
you just need one sizer on your panel. Add one spacer<br>
(sizer.add_stretch_spacer) before and one after your text.<br>
<br>
Like so:<br>
<br>
&nbsp;&nbsp;&nbsp; sizer = BoxSizer.new HORIZONTAL<br>
&nbsp;&nbsp;&nbsp; sizer.add_stretch_spacer<br>
&nbsp;&nbsp;&nbsp; sizer.add StaticText.new(self, -1, 'asdf'), 0, 1<br>
&nbsp;&nbsp;&nbsp; sizer.add_stretch_spacer<br>
<br>
hth,<br>
Christian.<br>
<br>
Alejandro Michelin salomon wrote:<br>
&gt; Hi<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I have frame.<br>
&gt;<br>
&gt; Inside i want to put a static text as title, centered.<br>
&gt;<br>
&gt; I use two sizers, one vertical an other horizontal.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But title is not centered, is put to left.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; My code is :<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; require 'wx';<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; class TarefasNova &lt; Wx::Panel<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; def initialize(parent)<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rect =
parent.get_client_rect();<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super( parent, 1011,
Wx::Point.new( 0, 0 ),&nbsp; rect.get_size(),<br>
&gt; SIMPLE_BORDER, &quot;NovaTarefa&quot; );<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizer =
Wx::BoxSizer.new(Wx::VERTICAL );<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; box&nbsp;&nbsp; =
Wx::BoxSizer.new(Wx::HORIZONTAL);<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label =
Wx::StaticText.new( self, :label =&gt; &quot;CADASTRO DE TAREFAS<br>
&gt; (NOVA)&quot;, :size =&gt; [250,-1] );<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; box.add( label, 1,
Wx::ALIGN_CENTER_VERTICAL, 5);<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizer.add_item(box, 0,
Wx::ALIGN_CENTER|Wx::ALL, 5);<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; How to make my title centered in the panel?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Alejandro Michelin Salomon<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp; _____<br>
&gt;<br>
&gt; avast! Antivirus &lt;<a href="http://www.avast.com">http://www.avast.com</a>&gt;
: Outbound message clean.<br>
&gt;<br>
&gt;<br>
&gt; Virus Database (VPS): 090319-0, 19/03/2009<br>
&gt; Tested on: 19/03/2009 17:32:59<br>
&gt; avast! - copyright (c) 1988-2009 ALWIL Software.<br>
<br>
--<br>
Posted via <a href="http://www.ruby-forum.com/">http://www.ruby-forum.com/</a>.<br>
_______________________________________________<br>
wxruby-users mailing list<br>
wxruby-users@rubyforge.org<br>
<a href="http://rubyforge.org/mailman/listinfo/wxruby-users">http://rubyforge.org/mailman/listinfo/wxruby-users</a></span>
<o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p>

<table class=MsoNormalTable border=0 cellpadding=0 width=400 style='width:300.0pt'>
 <tr>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <div class=MsoNormal align=center style='text-align:center'>
  <hr size=2 width="100%" align=center>
  </div>
  <p style='line-height:11.0pt'><span style='font-size:9.0pt;font-family:"Verdana","sans-serif"'><a
  href="http://www.avast.com">avast! Antivirus</a>: Inbound message clean. <o:p></o:p></span></p>
  <p style='line-height:11.0pt'><span style='font-size:8.0pt;font-family:"Verdana","sans-serif"'>Virus
  Database (VPS): 090319-0, 19/03/2009<br>
  Tested on: 20/03/2009 07:35:25<br>
  <span style='color:gray'>avast! - copyright (c) 1988-2009 ALWIL Software.</span><o:p></o:p></span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>
<html>
<BR><BR>
<TABLE width=400><HR>
<P style="FONT: 9pt/11pt verdana"><a href="http://www.avast.com">avast! Antivirus</a>: Outbound message clean.
<P style="FONT: 8pt/11pt verdana">Virus Database (VPS): 090319-0, 19/03/2009<BR>Tested on: 20/03/2009 09:05:48<BR><FONT color=gray>avast! - copyright (c) 1988-2009 ALWIL Software.</FONT></P>
<TBODY></TBODY></TABLE>
<BR></html>