1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 03:49:56 +00:00

Allows TrackBar controls to have ticks hidden. Closes #79.

This commit is contained in:
FellippeHeitor 2018-09-02 20:01:00 -03:00
parent 79fe5df319
commit ec2184f2c5
4 changed files with 37 additions and 2 deletions

View file

@ -127,7 +127,9 @@ TYPE __UI_Types
Count AS LONG Count AS LONG
TurnsInto AS INTEGER TurnsInto AS INTEGER
DefaultHeight AS INTEGER DefaultHeight AS INTEGER
MinimumHeight AS INTEGER
DefaultWidth AS INTEGER DefaultWidth AS INTEGER
MinimumWidth AS INTEGER
RestrictResize AS _BYTE RestrictResize AS _BYTE
END TYPE END TYPE
@ -276,7 +278,8 @@ __UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar" __UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300 __UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 45 __UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV __UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu" __UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
@ -4628,7 +4631,6 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt
IF ControlType = __UI_Type_TrackBar THEN IF ControlType = __UI_Type_TrackBar THEN
Control(NextSlot).Max = 10 Control(NextSlot).Max = 10
Control(NextSlot).Interval = 1 Control(NextSlot).Interval = 1
Control(NextSlot).Height = 40
END IF END IF
IF ControlType = __UI_Type_Form THEN IF ControlType = __UI_Type_Form THEN

View file

@ -74,6 +74,7 @@ DIM SHARED Disabled AS LONG, Transparent AS LONG
DIM SHARED Hidden AS LONG, CenteredWindow AS LONG DIM SHARED Hidden AS LONG, CenteredWindow AS LONG
DIM SHARED Resizable AS LONG, AutoScroll AS LONG DIM SHARED Resizable AS LONG, AutoScroll AS LONG
DIM SHARED AutoSize AS LONG, SizeTB AS LONG DIM SHARED AutoSize AS LONG, SizeTB AS LONG
DIM SHARED HideTicks AS LONG
'Open dialog 'Open dialog
DIM SHARED DialogBG AS LONG, FileNameLB AS LONG DIM SHARED DialogBG AS LONG, FileNameLB AS LONG
@ -395,6 +396,9 @@ SUB __UI_Click (id AS LONG)
CASE AutoSize CASE AutoSize
b$ = MKI$(Control(id).Value) b$ = MKI$(Control(id).Value)
SendData b$, 39 SendData b$, 39
CASE HideTicks
b$ = MKI$(Control(id).Value)
SendData b$, 42
CASE ViewMenuPreview CASE ViewMenuPreview
$IF WIN THEN $IF WIN THEN
SHELL _DONTWAIT ".\InForm\UiEditorPreview.exe " + HostPort SHELL _DONTWAIT ".\InForm\UiEditorPreview.exe " + HostPort
@ -1770,6 +1774,7 @@ SUB __UI_BeforeUpdateDisplay
Control(Resizable).Value = PreviewControls(FirstSelected).CanResize Control(Resizable).Value = PreviewControls(FirstSelected).CanResize
Control(AutoScroll).Value = PreviewControls(FirstSelected).AutoScroll Control(AutoScroll).Value = PreviewControls(FirstSelected).AutoScroll
Control(AutoSize).Value = PreviewControls(FirstSelected).AutoSize Control(AutoSize).Value = PreviewControls(FirstSelected).AutoSize
Control(HideTicks).Value = (PreviewControls(FirstSelected).Height = __UI_Type(__UI_Type_TrackBar).MinimumHeight)
IF LEN(PreviewContextMenu(FirstSelected)) THEN IF LEN(PreviewContextMenu(FirstSelected)) THEN
DIM ItemFound AS _BYTE DIM ItemFound AS _BYTE
ItemFound = SelectItem(ContextMenuControlsList, PreviewContextMenu(FirstSelected)) ItemFound = SelectItem(ContextMenuControlsList, PreviewContextMenu(FirstSelected))
@ -1957,6 +1962,7 @@ SUB __UI_BeforeUpdateDisplay
END SELECT END SELECT
NEXT NEXT
CASE __UI_Type_TrackBar CASE __UI_Type_TrackBar
Control(HideTicks).Disabled = False
FOR i = 1 TO UBOUND(InputBox) FOR i = 1 TO UBOUND(InputBox)
SELECT CASE InputBox(i).ID SELECT CASE InputBox(i).ID
CASE CaptionTB, TextTB, FontTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, BulletOptions, BooleanOptions, FontList CASE CaptionTB, TextTB, FontTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, BulletOptions, BooleanOptions, FontList
@ -2554,6 +2560,7 @@ SUB __UI_OnLoad
i = i + 1: Toggles(i) = Resizable i = i + 1: Toggles(i) = Resizable
i = i + 1: Toggles(i) = AutoScroll i = i + 1: Toggles(i) = AutoScroll
i = i + 1: Toggles(i) = AutoSize i = i + 1: Toggles(i) = AutoSize
i = i + 1: Toggles(i) = HideTicks
REDIM _PRESERVE Toggles(1 TO i) AS LONG REDIM _PRESERVE Toggles(1 TO i) AS LONG
ToolTip(FontTB) = "Multiple fonts can be specified by separating them with a question mark (?)." + CHR$(10) + "The first font that can be found/loaded is used." ToolTip(FontTB) = "Multiple fonts can be specified by separating them with a question mark (?)." + CHR$(10) + "The first font that can be found/loaded is used."

View file

@ -566,6 +566,10 @@ SUB __UI_LoadForm
SetCaption __UI_NewID, "Auto-scroll" SetCaption __UI_NewID, "Auto-scroll"
Control(__UI_NewID).CanHaveFocus = True Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "HideTicks", 181, 20, 12, 232, __UI_GetID("ControlToggles"))
SetCaption __UI_NewID, "Hide ticks"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "ColorPropertiesList", 161, 21, 10, 20, __UI_GetID("ColorMixer")) __UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "ColorPropertiesList", 161, 21, 10, 20, __UI_GetID("ColorMixer"))
AddItem __UI_NewID, "ForeColor" AddItem __UI_NewID, "ForeColor"
AddItem __UI_NewID, "BackColor" AddItem __UI_NewID, "BackColor"
@ -856,4 +860,5 @@ SUB __UI_AssignIDs
SizeTB = __UI_GetID("SizeTB") SizeTB = __UI_GetID("SizeTB")
ContextMenuLB = __UI_GetID("ContextMenuLB") ContextMenuLB = __UI_GetID("ContextMenuLB")
ContextMenuControlsList = __UI_GetID("ContextMenuControlsList") ContextMenuControlsList = __UI_GetID("ContextMenuControlsList")
HideTicks = __UI_GetID("HideTicks")
END SUB END SUB

View file

@ -1307,6 +1307,27 @@ SUB __UI_BeforeUpdateDisplay
Control(__UI_FormID).ContextMenuID = __UI_GetID(b$) Control(__UI_FormID).ContextMenuID = __UI_GetID(b$)
END IF END IF
END IF END IF
CASE 42 'HideTicks
b$ = ReadSequential$(Property$, 2)
IF TotalLockedControls THEN
FOR j = 1 TO TotalLockedControls
IF CVI(b$) THEN
Control(LockedControls(j)).Height = __UI_Type(__UI_Type_TrackBar).MinimumHeight
ELSE
Control(LockedControls(j)).Height = __UI_Type(__UI_Type_TrackBar).DefaultHeight
END IF
NEXT
ELSE
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
IF CVI(b$) THEN
Control(i).Height = __UI_Type(__UI_Type_TrackBar).MinimumHeight
ELSE
Control(i).Height = __UI_Type(__UI_Type_TrackBar).DefaultHeight
END IF
END IF
NEXT
END IF
CASE 201 TO 210 CASE 201 TO 210
'Alignment commands 'Alignment commands
b$ = ReadSequential$(Property$, 2) b$ = ReadSequential$(Property$, 2)