#1 2016-01-31 17:14:30

datadon
Member
Registered: 2015-04-23
Posts: 108

Justification of Labels

I have a lable that I want centered width wise on my screen even when the size changes.  How can I set the label property to center that way?  Or right justify for that matter?

Thanks

Offline

#2 2016-01-31 18:46:21

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Justification of Labels

Hello Donald,

One possible way (if you have the very latest release of App Builder published right now) is to use the "TextAlign" CSS property of the Label control. In the object inspector, you can view a "TextAlign" property in the "Normal", "Hover" and "Focus" tab. Just choose one of the available values for this property like "center", "right", etc.

Another possible way to align the Label can be using their "Classes" variable. In that variable we can put the value "text-center" or "text-right". These CSS clases are provided by Bootstrap CSS and has available from us.

Another possible way is to use the app's "Inlince CSS". Access to that from the app's options dialog or from the designer object inspector. In the CSS editor, write something like the below code, suposing your Label name is "Label1", change the identifier for your Label's name.

#Label1
{
  text-align: center;
}

The above code center the label.

#Label1
{
  text-align: right;
}

The above code align the label to the right. Other possible values for "text-align" can be found here. This way can be useful, because we can use media queries, for example:

@media (max-width: 500px) 
{
  #Label1
  {
    text-align: right;
  }
}

The above code means "If the browser window is smaller than 500px, put the 'Label1' to the right".

Finally, we can also use some actions to change the Label's alignment programatically, for example:

// By set the CSS
SetStyle "Label1" "text-align" "right"

// By set a Bootstrap class
AddClass "Label1" "text-right"

Hope this can help you Donald. If you have any further question don't hesitate to post it.

Offline

#3 2016-01-31 22:29:52

datadon
Member
Registered: 2015-04-23
Posts: 108

Re: Justification of Labels

Sweet!  Really nice.

Thanks David

Offline

#4 2016-01-31 23:14:56

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Justification of Labels

Always thanks you Donald. smile

Offline

#5 2016-02-15 13:54:02

datadon
Member
Registered: 2015-04-23
Posts: 108

Re: Justification of Labels

I guess this is related, but how do I allign text in a pushbutton.  My text is on the bottom edge of the buttton, so I tried the paddingbottom css but it does not do anything.  I'm not sure what value it would be looking for anyway.  Is it pixals?  10 or 10px or ?

I'm looking for way to get my text centered in all directions in a pushbutton, regardless of what size the button.

Ok maybe this is not an issue as I notice when installed on my phone the text seems centered but not so much in the debugger view.

So....

Last edited by datadon (2016-02-15 15:49:53)

Offline

#6 2016-02-15 22:55:12

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Justification of Labels

Hello Donald,

This is quite strange. The push button's text appear centered by default... how you get a button with their label not centered? Can you provide me a little sample application?

Offline

#7 2016-02-16 01:52:44

datadon
Member
Registered: 2015-04-23
Posts: 108

Re: Justification of Labels

As I said, it does appear centered correctly in the installed app.  But in the debugger view it is centered horizontal, but not vertical.  I will send you an image by email.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.