'Code for a button control and related callback function follow.
'I'm getting an "impossible" result (see 'problem, described
' below). Any explanation of how I can stop this from happening,
' or why it might be happening would be very much appreciated.
'The program seemed to be running perfectly, until I "filled in"
'some code in the previously empty CALLBACK function below, as
'it had been created by EZGUI. Bug in PBDLL60? or EZGUI?
'--------------------------------------------------------------
%FORM1_SELECTCORPBUTTON = 1 'Control ID number
CONTROL ADD BUTTON, hForm1&, %FORM1_SELECTCORPBUTTON, "Select &Corp.", 148, 69,_
66, 15, %WS_CHILD OR %WS_VISIBLE OR %BS_DEFPUSHBUTTON OR %WS_TABSTOP _
CALL CBF_FORM1_SELECTCORPBUTTON
'Related Callback Function, which is called ONLY from the one
'button control above, and from absolutely nowhere else in the
'program:
' ------------------------------------------------
CALLBACK FUNCTION CBF_FORM1_SELECTCORPBUTTON
IF CBCTLMSG=%BN_CLICKED THEN
MSGBOX "Why am I seeing this message now, when I didn't click this or any other button?"
LookUpSymBox(3&)
END IF
IF CBCTLMSG=%BN_SETFOCUS THEN
END IF
IF CBCTLMSG=%BN_KILLFOCUS THEN
END IF
END FUNCTION
' ------------------------------------------------
'Problem: Each time I enter a stock symbol in a text box
' control, in the same dialog (hForm1&) as the above button,
' the program calls the above callback, displaying the MSGBOX
' message I put in as a diagnostic, and then (unwanted!) it
' calls the LookUpSymBox( ) SUB to do a lookup. I cannot for
' the life of me understand how this is occurring, since the
' button in question is not being clicked, and thus nothing
' should be happening in the button's CALLBACK FUNCTION. When
' I DO click on that button, the callback works then, too (as it
' should, in that case), calling the LookUpSymBox() SUB.
' I noted that if I changed the value of %FORM1_SELECTCORPBUTTON = 1
' constant to something other than =1, and assigned the value =1
' to a different button control, whicho update a stock ticker string,
' then each time I enter a symbol in the Textbox control, the
' callback for the OTHER (stock ticker button) is hit instead,
' which is less of a problem, but is still a mystery.
'The obvious kludge solution was to make sure none of the control ID
' constants for this dialog had a value of 1, but that creates
' another strange problem: Pressing the enter key after entering
' stock symbols in the text box no longer has any effect, unless
' one of the other controls in the same dialog has the constant ID%
' value of 1, for some odd reason. Needless to say, nothing in the
' PBDLL documentation mentions that you must assign the value =1
' to at least one control (not a label -- that doesn't work) in
' the dialog in question, rather than some other unique, arbitrary
' value, or else a textbox for data entry won't work properly
' when the ENTER key is pressed.
------------------
'I'm getting an "impossible" result (see 'problem, described
' below). Any explanation of how I can stop this from happening,
' or why it might be happening would be very much appreciated.
'The program seemed to be running perfectly, until I "filled in"
'some code in the previously empty CALLBACK function below, as
'it had been created by EZGUI. Bug in PBDLL60? or EZGUI?
'--------------------------------------------------------------
%FORM1_SELECTCORPBUTTON = 1 'Control ID number
CONTROL ADD BUTTON, hForm1&, %FORM1_SELECTCORPBUTTON, "Select &Corp.", 148, 69,_
66, 15, %WS_CHILD OR %WS_VISIBLE OR %BS_DEFPUSHBUTTON OR %WS_TABSTOP _
CALL CBF_FORM1_SELECTCORPBUTTON
'Related Callback Function, which is called ONLY from the one
'button control above, and from absolutely nowhere else in the
'program:
' ------------------------------------------------
CALLBACK FUNCTION CBF_FORM1_SELECTCORPBUTTON
IF CBCTLMSG=%BN_CLICKED THEN
MSGBOX "Why am I seeing this message now, when I didn't click this or any other button?"
LookUpSymBox(3&)
END IF
IF CBCTLMSG=%BN_SETFOCUS THEN
END IF
IF CBCTLMSG=%BN_KILLFOCUS THEN
END IF
END FUNCTION
' ------------------------------------------------
'Problem: Each time I enter a stock symbol in a text box
' control, in the same dialog (hForm1&) as the above button,
' the program calls the above callback, displaying the MSGBOX
' message I put in as a diagnostic, and then (unwanted!) it
' calls the LookUpSymBox( ) SUB to do a lookup. I cannot for
' the life of me understand how this is occurring, since the
' button in question is not being clicked, and thus nothing
' should be happening in the button's CALLBACK FUNCTION. When
' I DO click on that button, the callback works then, too (as it
' should, in that case), calling the LookUpSymBox() SUB.
' I noted that if I changed the value of %FORM1_SELECTCORPBUTTON = 1
' constant to something other than =1, and assigned the value =1
' to a different button control, whicho update a stock ticker string,
' then each time I enter a symbol in the Textbox control, the
' callback for the OTHER (stock ticker button) is hit instead,
' which is less of a problem, but is still a mystery.
'The obvious kludge solution was to make sure none of the control ID
' constants for this dialog had a value of 1, but that creates
' another strange problem: Pressing the enter key after entering
' stock symbols in the text box no longer has any effect, unless
' one of the other controls in the same dialog has the constant ID%
' value of 1, for some odd reason. Needless to say, nothing in the
' PBDLL documentation mentions that you must assign the value =1
' to at least one control (not a label -- that doesn't work) in
' the dialog in question, rather than some other unique, arbitrary
' value, or else a textbox for data entry won't work properly
' when the ENTER key is pressed.
------------------
Comment