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

Simplifies enabling/disabling EditMenuAllowMinMax (UiEditor). Also:

- Fixes a bug that wouldn't allow copy/paste of .Max property.
- Makes NumericTextBoxes respect .Min/.Max properties when .NumericOnly changes between True/__UI_NumericWithBounds.
- Sets .Min/.Max to -32768/32767 (INTEGER range) at creation.
This commit is contained in:
FellippeHeitor 2018-05-13 19:07:39 -03:00
parent 44d36711bd
commit 52878db031
3 changed files with 25 additions and 21 deletions

View file

@ -1597,9 +1597,12 @@ SUB __UI_EventDispatcher
ELSEIF Control(__UI_FirstSelectedID).NumericOnly = __UI_NumericWithBounds THEN
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Hidden = False
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Value = True
ELSE
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Hidden = True
END IF
ELSE
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Hidden = True
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Value = False
END IF
IF Control(__UI_FirstSelectedID).Type = __UI_Type_Button THEN
IF __UI_FirstSelectedID <> __UI_DefaultButtonID THEN

View file

@ -882,18 +882,6 @@ SUB __UI_BeforeUpdateDisplay
ELSEIF CVI(b$) = -9 THEN
'User attempted to close the preview form
__UI_Click FileMenuNew
ELSEIF CVI(b$) = -12 THEN
'The conditions to enable "Allow .min/.max bounds" in Edit menu have been met
'Value = False
Control(EditMenuAllowMinMax).Disabled = False
Control(EditMenuAllowMinMax).Value = False
ELSEIF CVI(b$) = -13 THEN
'The conditions to enable "Allow .min/.max bounds" in Edit menu have been met
'Value = True
Control(EditMenuAllowMinMax).Value = True
ELSEIF CVI(b$) = -14 THEN
'The conditions to enable "Allow .min/.max bounds" in Edit menu have *NOT* been met
Control(EditMenuAllowMinMax).Value = False
END IF
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$
@ -974,8 +962,9 @@ SUB __UI_BeforeUpdateDisplay
END IF
Control(EditMenuSetDefaultButton).Disabled = True
Control(EditMenuAllowMinMax).Disabled = True
Control(EditMenuAllowMinMax).Value = False
SetCaption ControlProperties, "Control properties:"
Caption(AlignMenuAlignCenterV) = "Center Vertically (group)"
Caption(AlignMenuAlignCenterH) = "Center Horizontally (group)-"
@ -1032,11 +1021,11 @@ SUB __UI_BeforeUpdateDisplay
END IF
ELSEIF PreviewControls(FirstSelected).Type = __UI_Type_TextBox THEN
IF PreviewControls(FirstSelected).NumericOnly = True THEN
Control(EditMenuSetDefaultButton).Disabled = False
Control(EditMenuSetDefaultButton).Value = False
Control(EditMenuAllowMinMax).Disabled = False
Control(EditMenuAllowMinMax).Value = False
ELSEIF PreviewControls(FirstSelected).NumericOnly = __UI_NumericWithBounds THEN
Control(EditMenuSetDefaultButton).Disabled = False
Control(EditMenuSetDefaultButton).Value = True
Control(EditMenuAllowMinMax).Disabled = False
Control(EditMenuAllowMinMax).Value = True
END IF
END IF
END IF
@ -1495,8 +1484,14 @@ SUB __UI_BeforeUpdateDisplay
END SELECT
NEXT
CASE __UI_Type_TextBox
STATIC PreviousNumericState AS _BYTE
Control(Transparent).Disabled = False
Control(PasswordMaskCB).Disabled = (PreviewControls(FirstSelected).NumericOnly <> False)
Caption(MaxLB) = "Max"
IF PreviousNumericState <> PreviewControls(FirstSelected).NumericOnly THEN
PreviousNumericState = PreviewControls(FirstSelected).NumericOnly
__UI_ForceRedraw = True
END IF
IF PreviewControls(FirstSelected).NumericOnly = True THEN
FOR i = 1 TO UBOUND(InputBox)
SELECT CASE InputBox(i).ID
@ -1516,6 +1511,7 @@ SUB __UI_BeforeUpdateDisplay
END SELECT
NEXT
ELSE
Caption(MaxLB) = "Max length"
FOR i = 1 TO UBOUND(InputBox)
SELECT CASE InputBox(i).ID
CASE ValueTB, MinTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB
@ -1595,7 +1591,7 @@ SUB __UI_BeforeUpdateDisplay
'Properties relative to the form
Control(CenteredWindow).Disabled = False
Control(Resizable).Disabled = False
Caption(TextLB) = "Icon"
Caption(TextLB) = "Icon file"
FOR i = 1 TO UBOUND(InputBox)
SELECT CASE InputBox(i).ID

View file

@ -908,6 +908,8 @@ SUB __UI_BeforeUpdateDisplay
Control(TempValue).Name = "Numeric" + Control(TempValue).Name
SetCaption TempValue, RTRIM$(Control(TempValue).Name)
Control(TempValue).NumericOnly = True
Control(TempValue).Min = -32768
Control(TempValue).Max = 32767
IF __UI_ActiveMenu > 0 THEN
__UI_DestroyControl Control(__UI_ActiveMenu)
@ -1020,10 +1022,13 @@ END SUB
SUB AlternateNumericOnlyProperty
IF Control(__UI_FirstSelectedID).NumericOnly = True THEN
Control(__UI_FirstSelectedID).NumericOnly = __UI_NumericWithBounds
SendSignal -1
IF VAL(Text(__UI_FirstSelectedID)) > Control(__UI_FirstSelectedID).Max THEN
Text(__UI_FirstSelectedID) = LTRIM$(STR$(Control(__UI_FirstSelectedID).Max))
ELSEIF VAL(Text(__UI_FirstSelectedID)) < Control(__UI_FirstSelectedID).Min THEN
Text(__UI_FirstSelectedID) = LTRIM$(STR$(Control(__UI_FirstSelectedID).Min))
END IF
ELSEIF Control(__UI_FirstSelectedID).NumericOnly = __UI_NumericWithBounds THEN
Control(__UI_FirstSelectedID).NumericOnly = True
SendSignal -1
END IF
END SUB
@ -2359,7 +2364,7 @@ SUB SavePreview (Destination AS _BYTE)
END IF
IF Control(i).Max <> 0 THEN
b$ = MKI$(-16) + _MK$(_FLOAT, Control(i).Max)
IF Disk THEN PUT #BinFileNum, , b$ ELSE ELSE Clip$ = Clip$ + b$
IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$
END IF
IF Control(i).ShowPercentage THEN
b$ = MKI$(-19)