I have a dialog that creates a Combobox as part of its controls.
I want to process the result of the user choosing a diffrent item. When I use the ID in CBCTL the processing is done MULTIPLE times???
Also the this ID in CBCTL is called after I open a dialog box and the user selects a file. Why?
Here is the bare bones in an example:
(the show btn shows the number of times the ID is called.
#COMPILE EXE "Combo.exe" ' Combo problem example
#INCLUDE "WIN32API.INC" ' Win API definitions
GLOBAL Called AS LONG
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
CALLBACK FUNCTION MainCB() AS LONG
SELECT CASE CBMSG
CASE %WM_INITDIALOG
COMBOBOX ADD CBHNDL, 99, " CME 08:30 to 15:15"
COMBOBOX ADD CBHNDL, 99, " CBOT 08:30 to 15:15"
COMBOBOX ADD CBHNDL, 99, " NASDAQ 09:30 to 16:00"
COMBOBOX ADD CBHNDL, 99, " NYSE 09:30 to 16:00"
COMBOBOX ADD CBHNDL, 99, " AMEX 09:30 to 16:00"
COMBOBOX SELECT CBHNDL, 99, 1
END SELECT
SELECT CASE CBCTL
CASE 99
INCR called
'I want to CALL a function to process the ComboBox choice ONCE here
CASE 103
CONTROL SET TEXT CBHNDL, 114, " "+STR$(Called)
Called = 0
CASE 104 ' Quit
DIALOG END CBHNDL
END SELECT
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
FUNCTION PBMAIN
LOCAL hDlg AS LONG
DIALOG NEW 0, " example", 230, 60, 110, 159, 0 TO hDlg
CONTROL ADD COMBOBOX,hDlg, 99, , 4, 1, 102, 150, %CBS_DROPDOWNLIST
CONTROL ADD FRAME, hDlg, 100, "", 4, 13, 102, 93
CONTROL ADD FRAME, hDlg, 105, "", 4, 116, 102, 24
CONTROL ADD BUTTON, hDlg, 103, "Show", 35, 123, 40, 14, 0
CONTROL ADD BUTTON, hDlg, 104, "Quit", 5, 145, 100, 12, 1
CONTROL ADD LABEL, hDlg, 114, " ", 2, 108, 109, 12, 0
DIALOG SHOW MODAL hDlg CALL MainCB
END FUNCTION
------------------
Kind Regards
Mike
I want to process the result of the user choosing a diffrent item. When I use the ID in CBCTL the processing is done MULTIPLE times???
Also the this ID in CBCTL is called after I open a dialog box and the user selects a file. Why?
Here is the bare bones in an example:
(the show btn shows the number of times the ID is called.
#COMPILE EXE "Combo.exe" ' Combo problem example
#INCLUDE "WIN32API.INC" ' Win API definitions
GLOBAL Called AS LONG
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
CALLBACK FUNCTION MainCB() AS LONG
SELECT CASE CBMSG
CASE %WM_INITDIALOG
COMBOBOX ADD CBHNDL, 99, " CME 08:30 to 15:15"
COMBOBOX ADD CBHNDL, 99, " CBOT 08:30 to 15:15"
COMBOBOX ADD CBHNDL, 99, " NASDAQ 09:30 to 16:00"
COMBOBOX ADD CBHNDL, 99, " NYSE 09:30 to 16:00"
COMBOBOX ADD CBHNDL, 99, " AMEX 09:30 to 16:00"
COMBOBOX SELECT CBHNDL, 99, 1
END SELECT
SELECT CASE CBCTL
CASE 99
INCR called
'I want to CALL a function to process the ComboBox choice ONCE here
CASE 103
CONTROL SET TEXT CBHNDL, 114, " "+STR$(Called)
Called = 0
CASE 104 ' Quit
DIALOG END CBHNDL
END SELECT
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
FUNCTION PBMAIN
LOCAL hDlg AS LONG
DIALOG NEW 0, " example", 230, 60, 110, 159, 0 TO hDlg
CONTROL ADD COMBOBOX,hDlg, 99, , 4, 1, 102, 150, %CBS_DROPDOWNLIST
CONTROL ADD FRAME, hDlg, 100, "", 4, 13, 102, 93
CONTROL ADD FRAME, hDlg, 105, "", 4, 116, 102, 24
CONTROL ADD BUTTON, hDlg, 103, "Show", 35, 123, 40, 14, 0
CONTROL ADD BUTTON, hDlg, 104, "Quit", 5, 145, 100, 12, 1
CONTROL ADD LABEL, hDlg, 114, " ", 2, 108, 109, 12, 0
DIALOG SHOW MODAL hDlg CALL MainCB
END FUNCTION
------------------
Kind Regards
Mike
Comment