Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DateTimePicker unable to select and modify a specific field
#2
date adjustment code works correctly, but the DTS_UPDOWN style cannot be used.

Macro date2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 SysDateTimePick32 0x56030010 0x0 28 28 96 13 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DATE d.getclock ;;get current time
,d=d+1 ;;add 1 day
,;how to add 1 month?
,
,_s.timeformat("{yy-MM-dd}" d)
,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.code
,case DTN_DATETIMECHANGE
,NMDATETIMECHANGE* p=+nh
,if p.dwFlags=GDT_VALID
,,DateTime dt
,,dt.FromSYSTEMTIME(p.st)
,,_s.timeformat("{yy-MM-dd}" dt)
,,SendMessage(id(3 hDlg) DTM_SETFORMAT 0 _s)
,else out "empty"

The time picker is not adjustable.

Macro time2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 SysDateTimePick32 0x56030019 0x0 28 28 96 13 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,_s.timeformat("{HH:mm}")
,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.code
,case DTN_DATETIMECHANGE
,NMDATETIMECHANGE* p=+nh
,if p.dwFlags=GDT_VALID
,,DateTime dt
,,dt.FromSYSTEMTIME(p.st)
,,_s.timeformat("{HH:mm}" dt)
,,SendMessage(id(3 hDlg) DTM_SETFORMAT 0 _s)
,else out "empty"


Messages In This Thread
RE: DateTimePicker unable to select and modify a specific field - by Davider - 09-24-2023, 10:48 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)