henryreynolds
asked on
Format Strings
Hi
I Have a panel with 10 labels on it e.g...
Label1
Label2
Label3
eg......
On each label I display client Information like
Name : Jan Smith
Address : 1999 Bes str
Age : 30
I want to align each caption of the lables, currently it looks like above HOW do i format a string to say to align up perfectly.
This is what iam doing currently.
navItemAccNo.Caption := Format('%-20s',['Acc No'])+Format('%-1s',[':']) +trim(Fiel dByName('l PurCode'). AsString);
BUT still I cant DO a perfect allignment like THIS...
Name : Jan Smith
Address : 1999 Bes str
Age : 30
Thank you
I Have a panel with 10 labels on it e.g...
Label1
Label2
Label3
eg......
On each label I display client Information like
Name : Jan Smith
Address : 1999 Bes str
Age : 30
I want to align each caption of the lables, currently it looks like above HOW do i format a string to say to align up perfectly.
This is what iam doing currently.
navItemAccNo.Caption := Format('%-20s',['Acc No'])+Format('%-1s',[':'])
BUT still I cant DO a perfect allignment like THIS...
Name : Jan Smith
Address : 1999 Bes str
Age : 30
Thank you
Only way to do this is to use a proportional font, like Courier New, in the labels.
Otherwise, you can use two labels with the one on the left containing
'Name :', 'Address :' and 'Age :' and make those right-justified and aligned to each other on the right
and then the ones on the right containing the data left-justified and aligned to each other on the left.
Otherwise, you can use two labels with the one on the left containing
'Name :', 'Address :' and 'Age :' and make those right-justified and aligned to each other on the right
and then the ones on the right containing the data left-justified and aligned to each other on the left.
I meant fixed font, like rlibbly said, not proportional, which is what "MS Sans Serif" is.
Dont try it the way you descibed. Split your labels from:
Label1
Label2
Label3
eg......
into
Label1a Label1b
Label2b Label2b
Label3c Label3b
eg......
where Label1a = Data prompt and Label1b = Data value etc....
Label1
Label2
Label3
eg......
into
Label1a Label1b
Label2b Label2b
Label3c Label3b
eg......
where Label1a = Data prompt and Label1b = Data value etc....
ASKER
Hi
The problem why I cant use two labels for each set is as follows:
I am using a TdxNavBar component from Developers express, and I want to give my user the same look as win xp, when you go into my computer and you see the task, and folder information on the left. I want the user to see on the left of the screen all the employee details in the navbar and on the rest of my form their are edit boxes to enter values.. That way on my navbar I want to Allign The Details as :
Name : Jan
Surname : Koos
I MUST USER THE WORDING NAME, SURNAME,AGE,PASSPORT NUMBER, because otherwise the operator wont know what info are displaying.
Is their any other way how to align my detail, or must I use something else.
Thanx
The problem why I cant use two labels for each set is as follows:
I am using a TdxNavBar component from Developers express, and I want to give my user the same look as win xp, when you go into my computer and you see the task, and folder information on the left. I want the user to see on the left of the screen all the employee details in the navbar and on the rest of my form their are edit boxes to enter values.. That way on my navbar I want to Allign The Details as :
Name : Jan
Surname : Koos
I MUST USER THE WORDING NAME, SURNAME,AGE,PASSPORT NUMBER, because otherwise the operator wont know what info are displaying.
Is their any other way how to align my detail, or must I use something else.
Thanx
Without a fixed font, you will not be able to do it with one label, PERIOD.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Russell
Thank you , this is perfect IT works 100%,
Henry
Thank you , this is perfect IT works 100%,
Henry
It really depends on the font that you are using. What you are trying to do above requires a fixed pitch font, or alternatively, split the name / value pairs into 2 sets of labels (in the above you would have 6 labels).
Regards,
Russell