
Default button fires 2 events
I am running into a problem with buttons when the Cancel or Default
properties are set to True. This problem occurs when an object that is not
part of the eVB runtime (such as a grid control) is placed on the form. If
this occurs, two click events are fired when the Escape/Enter key is
pressed.
To demonstrate this problem, add a text box (Text1) and a command button
(command1) to an eVB form. Then add the following code:
Private Sub Command1_Click()
Text1.Text = Text1.Text & "Clicked! "
End Sub
Private Sub Form_Load()
Command1.Default = True
Command1.Cancel = True
End Sub
Running this code in the emulator with your keyboard, or a device with
buttons, works as expected: pressing the Escape/Enter key fires 1 click
event and updates the text box appropriately. Now, to duplicate the problem,
add an ActiveX control such as MSFlexGrid to the form. Pressing the
Escape/Enter key will now fire 2 click events.
Has anyone seen this problem or know of a fix/workaround? Our application
dynamically assigns cancel and default buttons. Our users should be able to
use both the touch screen and/or the buttons. Any help in solving this
problem is appreciated.
Thanks,
Mike Calahan