Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Formatting Sysdatetimepick32
#2
If you add DTS_APPCANPARSE style (0x10), user can freely edit date. Need to click 2 times, or click and press F2. Then, when user presses Enter or clicks another control or closes dialog, dialog receives DTN_USERSTRING notification which allows to validate the string.

Function DIALOG_REPORT_WINDOW
Code:
Copy      Help
;/PREVIEW REPORT WINDOW
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 249 135 "Choose Report Options"
;1 Button 0x54030000 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 SysDateTimePick32 0x50010010 0x10214 4 20 110 14 ""
;4 SysDateTimePick32 0x56030010 0x0 138 20 108 14 ""
;5 Static 0x54000000 0x0 30 6 48 10 "DATE FROM:"
;6 Static 0x54000000 0x0 168 6 44 10 "DATE TO:"
;7 ComboBox 0x54230242 0x0 6 54 88 213 "Providers"
;8 Static 0x54000000 0x0 6 40 58 12 "Choose Provider"
;9 Static 0x54000000 0x0 10 78 62 10 "Choose Location"
;10 Button 0x54032009 0x0 8 90 60 10 "Both Locations"
;11 Button 0x54002009 0x0 8 102 64 10 "Coral Springs"
;12 Button 0x54002009 0x0 8 114 64 12 "Boca Raton"
;END DIALOG
;DIALOG EDITOR: "" 0x2030109 "" "" ""

ret
;messages
SYSTEMTIME- t_st1 t_st4

sel message
,case WM_INITDIALOG
,;SendMessage(id(3 hDlg) DTM_SETFORMAT 0 "MM'/'dd'/'yyyy")
,;SendMessage(id(3 hDlg) DTM_SETFORMAT 0 "X'/'XX'/'XXX")
,SetFocus id(3 hDlg)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,SendMessage(id(3 hDlg) DTM_GETSYSTEMTIME 0 &t_st1)
,SendMessage(id(4 hDlg) DTM_GETSYSTEMTIME 0 &t_st4)
,
ret 1
;messages3
NMHDR* nh=+lParam
;if(nh.code!=NM_CUSTOMDRAW) OutWinMsg message wParam lParam
sel nh.code
,case DTN_USERSTRING
,NMDATETIMESTRING* ns=+nh
,DATE d=ns.pszUserString; err mes "incorrect date format"; ret
,d.tosystemtime(ns.st)
,ns.dwFlags=GDT_VALID

If it is not what you need, try callback fields. Documented in MSDN library.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)