Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Required Fields
#1
I have a dialog that I would like to require certain fields to be entered. What is the best way to go about that? I have a few ideas of my own...that aren't working...so I am open to suggestions.

Here is the code:
First this function called dialog with date picker:
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
def DTM_FIRST 0x1000
def DTM_GETSYSTEMTIME (DTM_FIRST + 1)
def DTM_SETSYSTEMTIME (DTM_FIRST + 2)

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 396 192 "New Student Form"
;10 Edit 0x54030080 0x200 6 6 90 12 "First"
;11 Edit 0x54030080 0x200 6 24 90 12 "Last"
;16 Edit 0x54030080 0x200 6 42 90 12 "Street"
;17 Edit 0x54030080 0x200 6 60 36 13 "City"
;19 Edit 0x54030080 0x200 48 60 12 13 "IL"
;18 Edit 0x54030080 0x200 66 60 30 13 "Zip"
;5 Edit 0x54030080 0x200 6 78 54 12 "BDay"
;20 Edit 0x54030080 0x200 102 6 90 12 "SchedName"
;21 Edit 0x54030080 0x200 102 24 90 12 "SchedNumber"
;22 Edit 0x54030080 0x200 102 42 90 12 "PayName"
;23 Edit 0x54030080 0x200 102 60 90 13 "PayNumber"
;25 Edit 0x54030080 0x200 102 78 90 12 "MobileNumber"
;24 Edit 0x54030080 0x200 102 96 90 12 "Email"
;4 ComboBox 0x54230243 0x0 198 6 90 213 "Teach"
;13 ComboBox 0x54230243 0x0 240 24 24 213 "Hour"
;14 ComboBox 0x54230243 0x0 264 24 24 213 "Min"
;3 SysDateTimePick32 0x54000000 0x204 198 42 90 12 "StartDate"
;12 Edit 0x54231044 0x200 198 60 90 48 "Notes"
;1 Button 0x54030001 0x4 294 66 36 12 "OK"
;2 Button 0x54030000 0x4 294 84 36 13 "Cancel"
;6 Static 0x50000000 0xA0 294 42 48 12 "Start Date"
;7 Static 0x54000000 0x0 294 6 48 12 "Intructor"
;8 Static 0x54000000 0x0 66 78 48 13 "Birthday"
;15 Static 0x50000000 0x0 294 24 48 12 "Lesson Time"
;26 Button 0x54012003 0x0 198 24 48 12 "Waitlist"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "*" "" ""


ret
;messages
SYSTEMTIME- t_st1
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,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)
,case IDCANCEL DT_Cancel hDlg
ret 1
Then the macro
Code:
Copy      Help
str controls = "10 11 16 17 19 18 20 21 22 23 25 24 5 4 13 14 12 26"
str First Last Street City State Zip SchedName SchedNumber PayName PayNumber Mobile Email Birthday Teach StartHr StartMin Notes Waitlist

Teach="&Andrew[]Jim[]James[]Don[]Derek"
StartHr="10[]11[]12[]1[]2[]&3[]4[]5[]6[]7"
StartMin="&00[]15[]30[]45"
Street="Street Address"
City="City"
Zip="Zip"
State="IL"
Birthday="mm/dd/yyy"
First="First Name"
Last="Last Name"
Notes="Notes"
SchedName="Schedule Name"
SchedNumber="Schedule Number"
PayName="Payment Name"
PayNumber="Payment Number"
Email="Email"
Mobile="Mobile Number"
if(!ShowDialog("dialog_with_date_picker" &dialog_with_date_picker &controls)) ret
I have been successful in getting an message to pop up with:
Code:
Copy      Help
if First="First Name"
,sel(mes("You Forgot the First Name!" "" "CE!"))
,,case 'C'
,,,goto next
,,case 'T'
,,,goto TryAgain
,,case 'E'
,,,goto End
But really then I don't know how to restart the macro with the dialog already filled out with other information that may have been accurate. Really I would like it to just go back to the dialog the way it was before hitting OK.

I don't know.
#2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 60 34 96 14 ""
;4 Static 0x54000002 0x0 10 36 48 13 "Name:"
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""

str controls = "3"
str e3
if(!ShowDialog("CheckFld" &CheckFld &controls)) ret
out e3
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,str a.getwintext(id(3 hDlg))
,if a=""
,,mes "Please fill required fields"
,,ret
,case IDCANCEL
ret 1
#3
Ok...I got this to work and I see that it does what I want.

I am having troubles getting it to integrate into my script. I can get the message to pop up when the field contains the default text, but the main dialog gets destroyed in my macro. I am sure it has to do with the systemdatepicker32. I really don't know how to proceed.

Thanks for the help so far.
#4
I got it...thanks


Forum Jump:


Users browsing this thread: 1 Guest(s)