Mega Search
23.2 Million


Sign Up

Make a donation  
TMonthCalendar and Chinese locale  
News Group: embarcadero.public.delphi.vcl.components.using

I have a TMonthCalendar component on a form in Delphi XE5 app for date selection. I have a Chinese customer who sent me this screen shot of his form:

http://imgur.com/3icMyGO

Notice that Saturdays on the right edge are cut off and unselectable. I'm guessing this due to the width of the Chinese characters in the dow headers. Can I force TMonthCalendar to a US English locale? Otherwise, what do I do about this? I tried widening the form to stretch the component but it's not resizeable.

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 9-Dec-2014, at 12:08 PM EST
From: Kent Briggs
 
Re: TMonthCalendar and Chinese locale  
News Group: embarcadero.public.delphi.vcl.components.using
> {quote:title=Just JJ wrote:}{quote}
> Make sure the designed TMonthCalendar control is wider than the drawn
> calendar's width

Thanks, I'll give that a try first before messing with the locale settings per Peter's instructions.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 12-Dec-2014, at 1:43 PM EST
From: Kent Briggs
 
Re: TMonthCalendar and Chinese locale  
News Group: embarcadero.public.delphi.vcl.components.using
On Tue, 9 Dec 2014 12:08:19 -0800, Kent Briggs wrote:
> I have a TMonthCalendar component on a form in Delphi XE5 app for date
> selection. I have a Chinese customer who sent me this screen shot of his
> form: 
> 
> http://imgur.com/3icMyGO 
> 
> Notice that Saturdays on the right edge are cut off and unselectable. I'm
> guessing this due to the width of the Chinese characters in the dow
> headers. Can I force TMonthCalendar to a US English locale? Otherwise,
> what do I do about this? I tried widening the form to stretch the
> component but it's not resizeable.

Make sure the designed TMonthCalendar control is wider than the drawn
calendar's width if you're developing the software using English locale.
Wide enough to allow wider calendar such as the one with Chinese locale,
when it's drawn. i.e. leave some horizontal space *in* it (in TMonthCalendar
control client area; not the spaces between other VCL controls).

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 11-Dec-2014, at 1:32 AM EST
From: Just JJ
 
Re: TMonthCalendar and Chinese locale  
News Group: embarcadero.public.delphi.vcl.components.using
Kent Briggs wrote:

> I have a TMonthCalendar component on a form in Delphi XE5 app for
> date selection. I have a Chinese customer who sent me this screen
> shot of his form:
> 
> http://imgur.com/3icMyGO
> 
> Notice that Saturdays on the right edge are cut off and unselectable.
> I'm guessing this due to the width of the Chinese characters in the
> dow headers. Can I force TMonthCalendar to a US English locale?
> Otherwise, what do I do about this? I tried widening the form to
> stretch the component but it's not resizeable.

The TMonthCalendar is a thin wrapper of the MS month calendar common
control (see
ms-help://embarcadero.rs_xe5/ShellCC/platform/commctls/monthcal/monthcal
..htm in the online help, or
http://msdn.microsoft.com/en-us/library/windows/desktop/bb760917%28v=vs.85%29.aspx).

The only thing I see in the docs that may influence the day names used
is the MCS_SHORTDAYSOFWEEK style.
So try this:

  setwindowlong(monthcalendar1.handle, GWL_STYLE, 
     getwindowlong(monthcalendar1.handle, GWL_STYLE) or
MCS_SHORTDAYSOFWEEK );

The style constant is declared in winapi.CommCtrl, which should already
be in your uses clause.

The control will use the names from the current user locale, and the
calendar display itself (drawn by Windows) does not seem to be
resizeable.



-- 
Peter Below (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 10-Dec-2014, at 10:24 AM EST
From: Peter Below