Thanks Gabriel,
I was busy with some other issues. I will give this a try and see if
it works for me.


On Apr 9, 2:18 am, Gabriel Ernesto Gutierrez Añez
<[email protected]> wrote:
> Yup!, i was with the doubt, so, if you try to get the width or the height of
> the label before it is rendered you'll get 0, if you do after you'll get the
> real value. the panel seems to have it before render takes place.
>
> regards,
> _____________________
> Ing. Gabriel Gutiérrez
> Celular: +52 1 81 1071 7213
> Oficina: +52    81 8153 2415
> Monterrey, México
>
> On Wed, Apr 8, 2009 at 4:14 PM, Gabriel Ernesto Gutierrez Añez <gutierrez.ge
>
>
>
> @gmail.com> wrote:
> > for both centering you can try this
>
> > label.setStyle("position:absolute");
>
> > and after the label has been rendered you do this
>
> > label.setPosition((leftPanel.getWidth()-label.getWidth())/2,
> >                 (leftPanel.getHeight()-label.getHeight())/2);
>
> > why after?
>
> > you need to have width and the height that the label and the panel, but
> > this happens when they show up, so, before the rendering is done the object
> > it self can't know about those attributes, or at least i dont know how to
> > get them before the rendering.
>
> > this was the code i used:
>
> >         Label label = new Label("Welcome");
> >>         label.setStyle("position: absolute;");
> >>         Panel leftPanel = new Panel();
> >>         leftPanel.setBorder(true);
> >>         leftPanel.setWidth(Window.getClientWidth() - 375);
> >>         leftPanel.setHeight(Window.getClientHeight());
> >>         leftPanel.setMonitorResize(true);
> >>         leftPanel.add(label);
>
> >>         RootPanel.get().add(leftPanel);
> >>         label.setPosition((leftPanel.getWidth()-label.getWidth())/2,
> >>                 (leftPanel.getHeight()-label.getHeight())/2);
>
> > Hope it helps.
> > _____________________
> > Ing. Gabriel Gutiérrez
> > Celular: +52 1 81 1071 7213
> > Oficina: +52    81 8153 2415
> > Monterrey, México
>
> > On Wed, Apr 8, 2009 at 3:12 PM, Neo <[email protected]> wrote:
>
> >> Hi,
> >> I have a gwtext Panel and I have set its layout as Horizontal Layout.
> >> I have added a Label to this panel. Now i want the label to appear in
> >> the center of the panel. I tried with text-align:center but it puts
> >> the label as top-center. What I really want is middle-center position.
> >> I also tried with vertical-align:middle. But it also did not work out.
> >> The following my code snippet :
>
> >> Label label = new Label("Welcome");
> >> label.setStyleName("htmlStyle");
>
> >> Panel leftPanel = new Panel();
> >> leftPanel.setBorder(true);
> >> leftPanel.setWidth(Window.getClientWidth() - 375);
> >> leftPanel.setHeight(Window.getClientHeight());
> >> leftPanel.setMonitorResize(true);
> >> leftPanel.add(label);
> >> leftPanel.setStyleName("leftPanelStyle");
>
> >> CSS
>
> >> .htmlStyle{
> >>        font-family:Calibri;
> >>        font-weight:normal;
> >>        font-size:20pt;
> >>        color:#000000;
> >> }
>
> >> .leftPanelStyle {
> >>        text-align:center !important;
> >>        vertical-align:middle !important;
> >> }
>
> >> It would be of great help if someone can please help me resolve this
> >> issue. Thank you.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to