Sorry, very basic question but can't find answer - how do I set the default button then will be activated if the enter key is pressed.
Announcement
Collapse
No announcement yet.
Default Button
Collapse
X
-
%BS_DEFAULT is the same as %BS_DEFPUSHBUTTON. The button with this style is "pressed" when the ENTER key is pressed, even if FOCUS in on another control. Therefore, Semen, changing focus does not change the default button for the ENTER key (it does affect the action of the SPACE key).
CONTROL SET FOCUS is a generic function designed to work with all [DDT] controls, so it does not update the appearance of buttons when focus is set. Try this small substitute sub to change focus and default button at the same time:
Code:SUB ButtonSetFocus(BYVAL hDlg AS LONG, BYVAL CtlId AS LONG) CONTROL SET FOCUS hDlg, CtlId CONTROL SEND hDlg, CtlId, %BM_SETSTYLE, %BS_DEFPUSHBUTTON, %TRUE END SUB
Code:CONTROL SEND hDlg, CtlId, %BM_SETSTYLE, %BS_PUSHBUTTON, %TRUE
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>Lance
mailto:[email protected]
Comment
Comment