Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Formatting Sysdatetimepick32
#1
Hi, I am using the Sysdatetimepicker32 in one of my forms. The format is mm/dd/yyyy, which is fine. However, I am unable to easily move or enter information within the date box. For instance, if I type 10/1/2009, once I type the "10" the only way to move to the "1" field is to use the right arrow key. I want to be able to just have a blank box appear with the //'s so that I can quickly and easily type in the full date without having to use the arrow keys. Also, I would like the date to be in focus and highlighted when the form first opens. Finally, if I press enter in the date box, it selects the ok button rather than just moving me to the next field. I have tried using:

case EN_SETFOCUS<<16|9
case EN_CHANGE<<16|9
,ifk(Y)key T

but these don't seem to work on the SysDateTimePicker32 control.

I appreciate any help anyone can offer. My code for the Macro and Dialog box is below.

macro
Macro PREVIEW REPORT WINDOW
Code:
Copy      Help
str m
sel(mes("DO YOU WANT TO PREVIEW THIS REPORT BEFORE PRINTING IT?" "" "&YN"))
,case 'Y'
,,m="Preview"
,case 'N'
,,m="Print"

out m


SYSTEMTIME- t_st1 t_st4 ;;we share these variables with the dialog procedure
str controls = "7 10 11 12"
str cb7Pro o10Bot o11Cor o12Boc
cb7Pro="&All Providers[]BARBRA[]BILLIE JO[]CONSTANCE[]DIANE[]FAUJIA[]FELICIA[]IRINA[]JOHN[]KIM E[]KIM K[]KIM T[]KIMIKO[]LARRY[]LINDA[]MARINO[]MARSHA F[]MARSHA T[]SANDY[]SCOTT[]SERGE"
o10Bot=&o10Bot


if(!ShowDialog("DIALOG_REPORT_WINDOW" &DIALOG_REPORT_WINDOW &controls)) ret

DATE d.fromsystemtime(t_st1) ;;convert to DATE (for easy display)
str s=d
out s

DATE e.fromsystemtime(t_st4)
str f=e
out f;;------------------------------------------

DATE dateF
int i=d.date ;;get integer part, that is date
dateF=i
out dateF

DATE dateT
int h=e.date
dateT=h
out dateT


;;----------------------------------------

;;GETS PROVIDER NAME SELECTED -- CONVERTS VALUE TO TEXT STRING
str Provider=val(cb7Pro)

if Provider="0"
,Provider= ""
if Provider="1"    
,Provider= "BARBRA"
if Provider="2"
,Provider= "BILLIE JO"
if Provider="3"
,Provider= "CONSTANCE"
if Provider="4"
,Provider= "DIANE"
if Provider="5"
,Provider= "FAUJIA"
if Provider="6"
,Provider= "FELICIA"
if Provider="7"
,Provider= "IRINA"
if Provider="8"
,Provider= "JOHN"
if Provider="9"
,Provider= "KIM "
if Provider="10"
,Provider= "KIM K"
if Provider="11"
,Provider= "KIM T"
if Provider="12"
,Provider= "KIMIKO"
if Provider="13"
,Provider= "LARRY"
if Provider="14"
,Provider= "LINDA"
if Provider="15"
,Provider= "MARINO"
if Provider="16"
,Provider= "MARSHA"
if Provider="17"
,Provider= "MARSHA T"
if Provider="18"
,Provider= "SANDY"
if Provider="19"
,Provider= "SCOTT"
if Provider="20"
,Provider= "SERGE"
str p
p=Provider

;;GETS LOCATION
str location
if o10Bot=1
,location=""
if o11Cor=1
,location="cs"
if o12Boc=1
,location="boca"
str l
l=location
;;------------------------------------------

;;display date

;;----------------------------------------

;SENDS VARIABLES AND OPENS DIALOG WINDOW TO ADD NEW VARIABLES
;PA_INTIALIZE_AND_CALL_WINDOW_DIALOG
;
;HERE IS WHERE YOU WOULD PUT IN NEW CODE FOR DIFFERENT TYPE OF REPORT.
;AND WHICH RANGES TO CHOOSE (IE. PATIENT PAYMENTS OR INS. PAYMENTS)
;'---------------------------------------------------

;OPEN THE PRACTICE ANALYSIS REPORT AND LOAD RANGES OF PAYMENT CODES
Load_Ranges____Patient_Payments_

;ADD REPORT WINDOW OPTIONS FROM VARIABLES ABOVE (DATES PROVIDER ETC)



;Goes to Date of Service Box
Acc b2=acc("Include 1" "PAGETAB" win("Print Practice Analysis" "#32770") "SysTabControl32" "" 0x1001)
b2.DoDefaultAction
Acc f2=acc("Date of Service:" "CLIENT" win("Print Practice Analysis" "#32770") "DateCtrl" "" 0x1001)
f2.Mouse(1)

outp dateF
'Y

outp dateT
'Y

;Output Provider Name (p)
if p=""
,goto labela1
Acc b3=acc("Include 2" "PAGETAB" win("Print Practice Analysis" "#32770") "SysTabControl32" "" 0x1001)
b3.DoDefaultAction
'Av
outp p
'Y

;labela1

;Output Location (l)
if l="1"
,goto labelaa
Acc b4=acc("Include 2" "PAGETAB" win("Print Practice Analysis" "#32770") "SysTabControl32" "" 0x1001)
b4.DoDefaultAction
'Al
outp l
'Y
;
;labelaa
;;THIS CODE PREVIEWS THE REPORT AND NEEDS TO BE ADDED TO THE END OF THE MACRO
;if(p!="preview")
,;Preview_Page3
;else
,;Print_Page3


DIALOG

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

def DTM_FIRST 0x1000
;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 0x50010000 0x10214 4 20 110 14 ""
;4 SysDateTimePick32 0x56030000 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
,DT_Init(hDlg lParam)
,;here can be initialized using DTM_SETSYSTEMTIME
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
int ctrlid=wParam&0xFFFF; message=wParam>>16
sel wParam
,case IDOK
,DT_Ok hDlg
,SendMessage(id(3 hDlg) DTM_GETSYSTEMTIME 0 &t_st1)
,SendMessage(id(4 hDlg) DTM_GETSYSTEMTIME 0 &t_st4)
,
,case IDCANCEL DT_Cancel hDlg
ret 1
#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.
#3
Thank you for your reply. It was not quite what I wanted but it was more useful than what I had and I am using it.

Would you be able to tell me how to save the choices made in the dialog so that the next time the dialog opens it will be automatically populated with the previous choices. Maybe have an option on the dialog to reset to default settings as well? Any help would be greatly appreciated.

Thanks again.
#4
Save dialog control values


Forum Jump:


Users browsing this thread: 1 Guest(s)