Jump to content
uniGUI Discussion Forums
Wicket

TunimDBNumberEdit text (field) alignment

Recommended Posts

Hi Guys,

 

I am having an issue with text alignment of TunimDBNumberEdit, its seems no matter the property I change it always appears right aligned, even when alignment is set to left.

I am using client side alignment and vbox on the form, and the fieldset contains the controls.

 

Below are two images, one of TunimDBEdit (which is aligned as I would expect) then TunimDBNumberEdit which is not.

 

Image Link to explain,

 

https://www.dropbox.com/s/ax4ewhm93b51oyy/text_alignment_issue.png?dl=0

 

 

Thanks

 

*Edit*

 

I am just trying to achieve a a list of fields which all work and align fine, apart from the TunimDBNumberEdit control. Am I missing something?

Share this post


Link to post
Share on other sites

Thanks, i will take a look once I am back at my computer.

 

I did search before posting this, not sure how I missed that post!

 

Sent from my Pixel using Tapatalk

Share this post


Link to post
Share on other sites

Sorry, seems you meant Label align

 

Ok, try this solution:

function beforeInit(sender, config)
{
    config.style = {'text-align':'left'};
}

Share this post


Link to post
Share on other sites

Rather than opening a new thread I will ask here as the problem is related. The above code works perfectly for controls created at design time.

However, I now need to create controls at runtime - and the alignment for the TUnimDbNumberEdit label is now incorrect, as per the image.

 

What do I need to do to make the label alignment as other controls, as per the image.

 

FYI - I am using touch 4.2, and build 1425 - I am hoping to upgrade to latest build ASAP, but for now I am stuck on this build, as I am just finishing the project.

 

https://www.dropbox.com/s/rojhmz3cwny5l80/label_alignment.png?dl=0

 

Thanks, Dan.

Share this post


Link to post
Share on other sites

Hi,

 

How do you create in runtime?
Can you give a sample code, and do you also assign a name to the component?

Share this post


Link to post
Share on other sites

I iterate a dataset to create any items, this is the reason why I create at runtime, as I do not know how many items are needed at design time.

I do not give the component a name

 

Here is the code I use, which creates all items as I want, just the label alignment can not be changed of TUnimDbNumberEdit.

 

   number := TUnimDbNumberEdit.Create(FrmMain);
   //alignment
    number.ClientEvents.UniEvents.Values['beforeInit']:= 'function beforeInit(sender, config) {config.style = {''text-align'':''left''}';
    number.Parent := fieldSet;
    number.DataSource := dsList;
    number.DataField := _FieldName;
    number.FieldLabel := _Caption;
    number.FieldLabelWidth := 40;

I will try giving the component a name and report back.

Share this post


Link to post
Share on other sites

I do not give the component a name

 

Assign a name to components

Share this post


Link to post
Share on other sites

OK, Once adding a name to the component I get 'Ajax Error' 'Unexpected Token' - which I guess means my JS is incorrect?

number.ClientEvents.UniEvents.Values['beforeInit']:= 'function beforeInit(sender, config) {config.style = {''text-align'':''left''}';

Can you confirm this is correct - perhaps the it does not like the double quoted string for {''text-align'':''left''} ?

Share this post


Link to post
Share on other sites

DOH! Embarrasing. Thanks , I've been looking at that code for the last 20 mins and just couldn't see the missing }

 

That's sorted my issue.

 

Thanks again

 

Sent from my Pixel using Tapatalk

Share this post


Link to post
Share on other sites

×