I hardly ever write GUI apps so this is probably a very simple thing to solve but I can't figure it out.
If you run this example, using the TAB key on the first run will cycle through the TEXTBOX, OPTION BUTTON and COMMAND BUTTON sections as expected, but once I click the CLEAR button (and reset the fields), Using TAB will go from the TEXTBOX directly to the Command Buttons--skipping the OPTION BUTTON sections. I can't figure out why (you can just type anything in the TextBox for now-or leave it blank).
I'm porting this from a PBCC app and the usual operation is that the program gets a batch number from the user, reads some stuff from a file and 'does its thing' and then resets for the next batch number--until the user quits.
I feel like this is due to something really simple like the placement of my
'%WS_' styles or the way I'm clearing the form in the CALLBACK.
By the way, is there a better way to reset everything on the form other than the way I'm doing it?
Thanks.
-Michael
If you run this example, using the TAB key on the first run will cycle through the TEXTBOX, OPTION BUTTON and COMMAND BUTTON sections as expected, but once I click the CLEAR button (and reset the fields), Using TAB will go from the TEXTBOX directly to the Command Buttons--skipping the OPTION BUTTON sections. I can't figure out why (you can just type anything in the TextBox for now-or leave it blank).
I'm porting this from a PBCC app and the usual operation is that the program gets a batch number from the user, reads some stuff from a file and 'does its thing' and then resets for the next batch number--until the user quits.
Code:
#COMPILE EXE #DIM ALL %USEMACROS = 1 #INCLUDE "WIN32API.INC" '////////////////////////////// %IDC_LABEL = 102 'Control ID's for the User Interface %IDC_LBL1_FRAME = 103 %IDC_LBL2_FRAME = 104 %IDC_TXTBOX = 105 %IDC_OPT_TV = 106 'TV Batch %IDC_OPT_FM = 107 'FM Batch %IDC_OPT_LB = 108 'LockBox %IDC_OPT_ME = 109 'Manual Entry %IDC_RUN = 110 %IDC_CLEAR = 111 %IDc_EXIT = 112 FUNCTION PBMAIN () AS LONG '/////////////////////////////////////////////////////////////////////////////////////////////// '// Build the user interface /////////////////////////////////////////////////////////////////// '/////////////////////////////////////////////////////////////////////////////////////////////// GLOBAL hDlg AS DWORD DIALOG NEW 0, "KERA: Batch Preview",,, 285, 115, %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg CONTROL ADD LABEL, hDlg, %IDC_LABEL, "Batch Number:", 12, 05, 50, 12 CONTROL ADD TEXTBOX, hDlg, %IDC_TXTBOX,"", 12, 15, 50, 13, CONTROL ADD FRAME, hDlg, %IDC_LBL1_FRAME, "Entity", 12, 35, 95, 42 CONTROL ADD FRAME, hDlg, %IDC_LBL2_FRAME, "Batch Type", 120, 35, 95, 42 CONTROL ADD OPTION, hDlg, %IDC_OPT_TV, "TV Batch", 17, 45, 80, 12, %WS_GROUP OR %WS_TABSTOP CONTROL ADD OPTION, hDlg, %IDC_OPT_FM, "FM Batch", 17, 60, 80, 12 CONTROL ADD OPTION, hDlg, %IDC_OPT_LB, "Lockbox", 125, 45, 80, 12, %WS_GROUP OR %WS_TABSTOP CONTROL ADD OPTION, hDlg, %IDC_OPT_ME, "Manual Entry", 125, 60, 80, 12 CONTROL ADD BUTTON, hDlg, %IDC_RUN, "&Run", 12, 83, 43, 20 CONTROL ADD BUTTON, hDlg, %IDC_CLEAR, "&Clear", 120, 83, 43, 20 CONTROL ADD BUTTON, hDlg, %IDC_EXIT, "E&xit", 172, 83, 43, 20 CONTROL SET FOCUS hDlg, %IDC_TXTBOX DIALOG SHOW MODAL hDlg, CALL DlgProc() '////////////////////////////////////////////////////////////////////////////////////////////// '////////////////////////////////////////////////////////////////////////////////////////////// END FUNCTION CALLBACK FUNCTION DlgProc() AS LONG SELECT CASE AS LONG CBMSG CASE %WM_INITDIALOG CASE %WM_COMMAND SELECT CASE AS LONG CBCTL CASE %IDC_EXIT IF CBCTLMSG = %BN_CLICKED THEN 'add code to close files, delete temp files DIALOG END CBHNDL END IF CASE %IDC_CLEAR IF CBCTLMSG = %BN_CLICKED THEN CONTROL SET CHECK hDlg, %IDC_OPT_TV, 0 'deselect the OptionButtons. CONTROL SET CHECK hDlg, %IDC_OPT_FM, 0 CONTROL SET CHECK hDlg, %IDC_OPT_LB, 0 CONTROL SET CHECK hDlg, %IDC_OPT_ME, 0 CONTROL SET TEXT hDlg, %IDC_TXTBOX, "" 'clear the Batch Number TextBox and CONTROL SET FOCUS hDlg, %IDC_TXTBOX 'reset the focus for a new entry. END IF CASE %IDC_RUN IF CBCTLMSG = %BN_CLICKED THEN 'Check the state of controls. Add error message if something is left 'blank or unselected. END IF END SELECT END SELECT END FUNCTION
'%WS_' styles or the way I'm clearing the form in the CALLBACK.
By the way, is there a better way to reset everything on the form other than the way I'm doing it?
Thanks.
-Michael
Comment