1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

Improves "Set as default button" to allow "unsetting" it.

This commit is contained in:
FellippeHeitor 2018-05-13 21:33:05 -03:00
parent 2f3bb59b8d
commit b755a52167
3 changed files with 16 additions and 7 deletions

View file

@ -1607,12 +1607,10 @@ SUB __UI_EventDispatcher
IF Control(__UI_FirstSelectedID).Type = __UI_Type_Button THEN
IF __UI_FirstSelectedID <> __UI_DefaultButtonID THEN
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Hidden = False
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Disabled = False
SetCaption __UI_GetID("__UI_PreviewMenuSetDefaultButton"), "&Set as default button-"
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Value = False
ELSE
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Hidden = False
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Disabled = True
SetCaption __UI_GetID("__UI_PreviewMenuSetDefaultButton"), "This is the default button-"
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Value = True
END IF
ELSE
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Hidden = True
@ -2357,7 +2355,11 @@ SUB __UI_EventDispatcher
CASE UCASE$("__UI_PreviewMenuNumericOnly")
__UI_KeyPress 223
CASE UCASE$("__UI_PreviewMenuSetDefaultButton")
__UI_DefaultButtonID = __UI_FirstSelectedID
IF __UI_DefaultButtonID = __UI_FirstSelectedID THEN
__UI_DefaultButtonID = 0
ELSE
__UI_DefaultButtonID = __UI_FirstSelectedID
END IF
CASE "__UI_PREVIEWMENUCUT": GOTO ControlCut
CASE "__UI_PREVIEWMENUCOPY": GOTO ControlCopy
CASE "__UI_PREVIEWMENUPASTE": GOTO ControlPaste

View file

@ -1033,8 +1033,11 @@ SUB __UI_BeforeUpdateDisplay
Control(AlignMenuDistributeH).Disabled = True
IF PreviewControls(FirstSelected).Type = __UI_Type_Button THEN
Control(EditMenuSetDefaultButton).Disabled = False
IF PreviewDefaultButtonID <> FirstSelected THEN
Control(EditMenuSetDefaultButton).Disabled = False
Control(EditMenuSetDefaultButton).Value = False
ELSE
Control(EditMenuSetDefaultButton).Value = True
END IF
ELSEIF PreviewControls(FirstSelected).Type = __UI_Type_TextBox THEN
IF PreviewControls(FirstSelected).NumericOnly = True THEN

View file

@ -388,7 +388,11 @@ SUB __UI_BeforeUpdateDisplay
SendSignal -7 'New form created
ELSEIF TempValue = -6 THEN
'Set current button as default
__UI_DefaultButtonID = __UI_FirstSelectedID
IF __UI_DefaultButtonID = __UI_FirstSelectedID THEN
__UI_DefaultButtonID = 0
ELSE
__UI_DefaultButtonID = __UI_FirstSelectedID
END IF
ELSEIF TempValue = -7 THEN
__UI_RestoreImageOriginalSize
ELSEIF TempValue = -1 THEN