Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SysDateTimePick32 in standard English language
#1
I understand that using a statement like :
SendMessage(id(3 hDlg) DTM_SETFORMAT 0 "dd-MMM-yy")

you may format a SysDateTimePick32 control accordingly.

However, I envisage the language problem! The string is displayed in my native language format. I would kindly ask for any advice to display it in standard English. Many thanks in advance.
#2
From quickly trying a few things i wasn't able to change the actual calendar to english but i was able to change the editable part to english 
if your worried about language just convert the date to english couple examples below

Function Dialogdatepick1 
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 SysDateTimePick32 0x56030010 0x0 28 28 96 13 ""
;4 Static 0x54000001 0x0 28 12 94 14 "Date in English"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SendMessage(id(3 hDlg) DTM_SETFORMAT 0 "dd-MMM-yy")
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
;sel nh.idFrom
,;case 3
sel nh.code
,case DTN_DATETIMECHANGE
,NMDATETIMECHANGE* p=+nh
,if p.dwFlags=GDT_VALID
,,DateTime dt
,,dt.FromSYSTEMTIME(p.st)
,,_s.timeformat("{dd-MMM-yy}" dt  WINAPI.LANG_ENGLISH|WINAPI.SUBLANG_ENGLISH_US)
,,_s.setwintext(id(4 hDlg))
,else out "empty"
 and changing editable part of datepicker
Function Dialogdatepick2 
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 SysDateTimePick32 0x56030010 0x0 28 28 96 13 ""
;4 Static 0x54000001 0x0 28 12 94 14 "Date in English"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,_s.timeformat("{dd-MMM-yy}" 0  WINAPI.LANG_ENGLISH|WINAPI.SUBLANG_ENGLISH_US)
,SendMessage(id(3 hDlg) DTM_SETFORMAT 0 _s)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
;sel nh.idFrom
,;case 3
sel nh.code
,case DTN_DATETIMECHANGE
,NMDATETIMECHANGE* p=+nh
,if p.dwFlags=GDT_VALID
,,DateTime dt
,,dt.FromSYSTEMTIME(p.st)
,,_s.timeformat("{dd-MMM-yy}" dt  WINAPI.LANG_ENGLISH|WINAPI.SUBLANG_ENGLISH_US)
,,_s.setwintext(id(4 hDlg))
,,SendMessage(id(3 hDlg) DTM_SETFORMAT 0 _s)
,else out "empty"

or can just convert it and not display the conversion

Code:
Copy      Help
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,sel nh.code
,,case DTN_DATETIMECHANGE
,,NMDATETIMECHANGE* p=+nh
,,if p.dwFlags=GDT_VALID
,,,DateTime dt
,,,dt.FromSYSTEMTIME(p.st)
,,,_s.timeformat("{dd-MMM-yy}" dt  WINAPI.LANG_ENGLISH|WINAPI.SUBLANG_ENGLISH_US)
,,else out "empty"
#3
Dear Kevin, many thanks indeed for these two very smart solutions! Best regards.

Dialogdatepick2 does not display correct month in english, if month is 03,05,10 (march,may,october) in control 3. I am investigating it.
#4
yeah didn't test that one fully.I have tested it now and March,May,August, and October don't display correctly. was just a quick thought and wasn't fully tested. but the static control displays the correct month always in my tests
#5
Thanks, I agree absolutely with your findings.


Forum Jump:


Users browsing this thread: 1 Guest(s)