Post new topic Reply to topic  [ 5 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Help

Author Message
 Post subject: [Closed] Changing button size
PostPosted: Sat May 10, 2008 1:46 am 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
How do I resize a button?
Code:
btn.setSize("40","40");

throws an error saying something like "This method must be called after the component has been rendered.
Code:
btn.addListener("render", new Function(){
   public void execute() {
      btn.setSize("40","40");
   }
});

doesn't change the button's width while it is distorted height-wise.


Attachments:
File comment: width doesn't change and button is distorted height-wise
resize_button.png
resize_button.png [ 2.94 KB | Viewed 1703 times ]

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Last edited by abhijeet.maharana on Sat May 10, 2008 2:09 pm, edited 1 time in total.
Back to top
 Profile  
 
 Post subject: Re: Changing button size
PostPosted: Sat May 10, 2008 2:47 am 
Offline

Joined: Thu Feb 07, 2008 10:26 am
Posts: 138
Location: Tunisia
Hi:

Use A Template to create a button with the suitable dimensions.

Button.setTemplate():
http://gwt-ext.com/docs/2.0.3/com/gwtex ... e.Template)

Template:
http://gwt-ext.com/docs/2.0.3/com/gwtex ... plate.html


Back to top
 Profile  
 
 Post subject: Re: Changing button size
PostPosted: Sat May 10, 2008 9:37 am 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
Thanx for the answer. It helped.

Default template for the button is a table with 3 columns. I modified it and applied width and height attributes to the center TD element and the button resized as expected. However, the background images don't stretch and unwanted parts of the sprite (btn-sprite.gif) show up.
Attachment:
resize_button_template.jpg
resize_button_template.jpg [ 3.77 KB | Viewed 1693 times ]

I am not comfortable with CSS. Tried tweaking x-btn-left, x-btn-center and x-btn-right CSS classes but in vain. Any idea as to what CSS change is necessary to stretch the background images?

Modified button template with width and height for center TD:
Code:
Template t = new Template("<table cellpadding=\"0\" cellspacing=\"0\" class=\"x-btn-wrap\">" +
   "<tbody>" +
      "<tr>" +
         "<td class=\"x-btn-left\"><i>&#160;</i></td>" +
         "<td class=\"x-btn-center\" width=\"80px\" height=\"80px\">" +
            "<em unselectable=\"on\"><button class=\"x-btn-text\" type=\"{1}\">{0}</button></em></td>" +
         "<td class=\"x-btn-right\"><i>&#160;</i></td>" +
      "</tr>" +
   "</tbody>" +
"</table>");
            
btn.setTemplate(t);

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Back to top
 Profile  
 
 Post subject: Re: Changing button size
PostPosted: Sat May 10, 2008 9:55 am 
Offline
Site Admin

Joined: Fri Dec 14, 2007 12:27 pm
Posts: 1017
See this thread : http://groups.google.com/group/gwt-ext/ ... 4b1f66b83d

Sanjiv


Back to top
 Profile  
 
 Post subject: Re: Changing button size
PostPosted: Sat May 10, 2008 12:07 pm 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
That helped. I still can't get the images to resize and span the entire background since background-size:100% doesn't have any effect but now I can replace the stock images in my custom template.

Thanks for the help.

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Back to top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Help


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.