Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Enter Key as a Tab Key in a Dialog
#1
Hi,

I'm trying to create a dialog box (see code below) that has 2 user input fields. After the user enters the text in field #1 I want to be able to hit the "Enter" key rather than the "Tab" key to move the cursor to Field #2. Right now, if I hit Enter after inputting text into Field #1, the Enter key acts as the "OK" button and closes the dialog box rather than moving the cursor to Field #2. Only now, once the user has entered text into Field #2, I want the enter button to act as the "OK" button.

If you are viewing the code below, just ignore the checkboxes as they are optional and the user can just click on one of the boxes before clicking on the OK button.

While I'm at it, here's one more question related to this dialog that I'm creating. My purpose for creating this dialog is to take one of three variables (the numbers 300, 100, and 175) subtract the amount input in Field #1 from that variable and output the difference to be used in a macro. Here's where the Check Boxes come into play. If neither checkbox is checked, then the default variable will = 175. If the 1st Checkbox is checked, the variable will = 300. If the 2nd Checkbox is checked, the variable will = 100. I then want to use the user input data in Field #1 and Field #2 as well as the number created from the subtraction above in a Macro that will enter the text automatically into a billing program I use.

Thanks for your help in advance!

Here's my dialog Code so far.

BEGIN DIALOG
0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
4 Edit 0x54030080 0x204 10 38 38 12 ""
7 Edit 0x54030080 0x204 10 56 38 12 ""
1 Button 0x54030001 0x4 120 116 48 14 "OK"
2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
3 Button 0x54012003 0x4 8 72 210 12 "90801 -- Check This Box if Billing 90801"
5 Button 0x54012003 0x4 8 88 210 10 "90862 -- Check This Box if Billing 90862"
6 Static 0x54020000 0x4 52 40 58 10 "Enter Allowable"
8 Static 0x54020000 0x4 52 58 120 10 "Enter Payment Amount Received"
END DIALOG
DIALOG EDITOR: "" 0x2010400 "" ""

ret
messages
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 EN_CHANGE<<16|4
case EN_SETFOCUS<<16|7
case IDOK DT_Ok hDlg
case IDCANCEL DT_Cancel hDlg
ret 1


Code Ends Here.

The Macro which I want these variables to be used, in partial form, is below. Basically I've set it up such that once the user has entered the information in the dialog, the macro below will take the information obtained and automatically output a combination of static text and the variables defined in the dialog into different fields of my billing program.

Code indicating where variables need to be input is below.

'1primaryY
'dosV
s.setsel
'Y
'((('VARIABLE FROM FIELD #2 should be on this line))))))
'Aa
'a
DATE_OUTPUT
'Y
'adjustiY
'insVallowsVS((((VARIABLE FROM FIELD #1 should go right here)
'Y
'((((VARIABLE OBTAINED AS A RESULT OF SUBTRACTING FIELD #1 FROM THE VALUE OF THE CHECKBOX OR NO CHECKBOX (IE., 100, 175 OR 300) GOES HERE)))
'Y

Thanks again for your help!
#2
In Dialog Editor, for each edit control that uses Enter as Tab, add ES_MULTILINE, ES_WANTRETURN and ES_AUTOVSCROLL styles. In code, for each of these controls, under case EN_CHANGE... insert

Code:
Copy      Help
,_s.getwintext(lParam); if(_s.end("[]")) key BT

This is answer to your first question. I hope somebody will answer to the rest.


Forum Jump:


Users browsing this thread: 1 Guest(s)