Button Alignment

Forum to discuss the Web client version of Servoy.

Button Alignment

Postby jasantana » Wed Mar 09, 2011 3:26 pm

I have a button with a style that aligns text to left, an image and a text

In SmartClient you can see it very well, the image and then the text, but in WebClient the text is shown over the image.

Is there a trick to solve this?
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: Button Alignment

Postby bobcusick » Wed Mar 09, 2011 5:44 pm

Buttons with icons and text on them don't behave that well in Web Client...

Something I've done in the past is to detect where the client is running and then "pad" the text of the button with " " (non-breaking spaces).

It's definitely a HACK, but it works.

Code: Select all
function foo(){
   if(application.getApplicationType() == APPLICATION_TYPES.WEB_CLIENT) {
      if(utils.stringLeft(elements.myButton.text,5) != " ") {
         elements.myButton.text = "    " + elements.myButton.text  //put as many spaces as you need
      }
   }
}
User avatar
bobcusick
 
Posts: 126
Joined: Mon Jan 12, 2009 9:13 pm

Re: Button Alignment

Postby jasantana » Wed Mar 09, 2011 6:53 pm

Thanks. I will do it that way
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 1 guest