Jump to content
JackT

Format text in TSpinBox

Recommended Posts

Is there an easy way to change the formatting of the text in a TSpinBox ?

 

I would like my TSpinBox to display a number with a leading 0 for a 24 hour clock format So instead of showing 9 it would show 09 as in "zero nine hundred hours".

 

I am aware there is a TTimeEdit, but it puts it's spinner in an up down configuration not it in a side to side configuration like the TSpinBox. 

 

I am using TSpinBox to set YEAR - MONTH - DAY so I would like everything to look the same, 

Share this post


Link to post

Thanks for the reply. Unfortunately I forgot to mention I am developing a Firemonkey application so TNumberBox has a different implementation to the VCL component with the same name, although I did post the question in the FMX group.

Share this post


Link to post

If the only reason you're not using the TTimeEdit is because of the tiny up/down arrows on Windows (which I agree are practically useless), then you could build your own compound component out of a couple of combo boxes and buttons all squished together.

 

But if you're targeting mobile platforms, you might want to see how the TTimeEdit looks on those platforms--they might look quite different. Or you you could use the IFMXPickerServices.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×