Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Button Default property and Onclick event

I have many buttons on many forms, all having the OnClick event with Left click triggering the function.
With one screen which I have set to have the Default=1 property this does not fire in this situation when you press enter.
Removing the check for Left click resolves.

Just thinking that perhaps the mouse button default should be set to "Left" when you press .

Comments

  • Pressing enter on a default button causes the button parameter to be set to "Enter". Likewise, executing a button via it's shortcut (e.g., Alt+K) causes it to be set to "Accelerator". This is by design since it provides maximum flexibility to programmers.

    I tend to organize my click handlers like so:

    Begin Case Case Button EQ "Middle" // Do middle click stuff Case Button EQ "Right" // Do right click stuff Case 1 // Do left click stuff End Case
    I do this because the Left click feels like a "default" click anyway.

    I updated the wiki documentation to list the other possible values of the button parameter.
Sign In or Register to comment.