Hi,
I'm trying to have a cell in the grid that allows user to see and input a datetime value. I'm using for this [UltraDateTimeEditor] which has the properties set as
datetimeEditor->FormatProvider = System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat; datetimeEditor->MaskInput = "{date} {time}"; datetimeEditor->FormatString = System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat->ShortDatePattern + " " + System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat->LongTimePattern; datetimeEditor->AutoFillTime = Infragistics::Win::UltraWinMaskedEdit::AutoFillTime::Midnight; datetimeEditor->AutoFillDate = Infragistics::Win::UltraWinMaskedEdit::AutoFillDate::MonthAndYear; datetimeEditor->Value = "00/00/0000 00:00:00";
but it display wrong datetime in a wrong format in a non-english enronment. See this image (windows is using Slovenian settings)https://www.dropbox.com/s/8tjkzmgjbcjkomm/1.png?dl=1
How do I set properly the properties to mimic exactly the system settings?
Thx
Hi Mitja,
As I said, the properties on the editor won't do much to affect the grid column. You need to set the properties on the grid column. Why are you using a DateTimeEditor here at all? You don't need one in order to format or mask a column in the grid.
Here's a new sample with a grid showing the same mask/format.
something here is not right. Yes, the datetime component works, but when used with the grid, is does not.
I first create the date control as you have in your sample, then I assign it to the Column object
column->EditorComponent = datetimeEditor; column->Format = System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat->ShortDatePattern + " " + System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat->LongTimePattern;
regardles if I am in edit or browse mode inside the grid, I do see the "AM" on a machine with Slovenian settings. see attached picture.
Here's my sample project so you can try it out on your machine, if you like.
It looks like the original screen shot you posted it no longer available, so I don't remember what it showed. For future reference, you can attach an image file by going to the Options tab when posting. That way the image will be attached to the post and won't rely on external sites like DropBox.
Anyway, I tried this just now with a standalone DateTimeEditor control and this is what it looks like on my machine. This seems correct to me.
Your original post mentions that you are using a grid, but the code does not reference a grid, it only uses a DateTimeEditor. So I'm not sure what the relationship is between this control and the grid. If you are using a grid, then you need to set the FormatProvider and other mask-related properties on the GRID COLUMN. The FormatProvider of the DateTimeEditor control will not have any effect on the grid.
ignore the 00/00 value, later I read correct values from database.
check the attached image for CultureInfo
https://www.dropbox.com/s/ac2uga7b45qhcej/si-culture.png?dl=0