mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 03:49:56 +00:00
Adjusts ListBox height to give items more vertical spacing.
This commit is contained in:
parent
6c4f729ef7
commit
e83bd67965
2 changed files with 17 additions and 14 deletions
|
@ -81,6 +81,7 @@ TYPE __UI_ControlTYPE
|
||||||
InputViewStart AS LONG
|
InputViewStart AS LONG
|
||||||
PreviousInputViewStart AS LONG
|
PreviousInputViewStart AS LONG
|
||||||
LastVisibleItem AS INTEGER
|
LastVisibleItem AS INTEGER
|
||||||
|
ItemHeight AS INTEGER
|
||||||
HasVScrollbar AS _BYTE
|
HasVScrollbar AS _BYTE
|
||||||
VScrollbarButton2Top AS INTEGER
|
VScrollbarButton2Top AS INTEGER
|
||||||
HoveringVScrollbarButton AS _BYTE
|
HoveringVScrollbarButton AS _BYTE
|
||||||
|
@ -1677,7 +1678,7 @@ SUB __UI_EventDispatcher
|
||||||
'Dropdown list items are preselected when hovered
|
'Dropdown list items are preselected when hovered
|
||||||
LastMouseTop = __UI_MouseTop
|
LastMouseTop = __UI_MouseTop
|
||||||
IF Control(__UI_HoveringID).Font > 0 THEN _FONT Control(__UI_HoveringID).Font
|
IF Control(__UI_HoveringID).Font > 0 THEN _FONT Control(__UI_HoveringID).Font
|
||||||
ThisItem% = ((__UI_MouseTop - (ContainerOffsetTop + Control(__UI_HoveringID).Top)) \ uspacing&) + Control(__UI_HoveringID).InputViewStart
|
ThisItem% = ((__UI_MouseTop - (ContainerOffsetTop + Control(__UI_HoveringID).Top) - (ABS(Control(__UI_HoveringID).HasBorder) * __UI_DefaultCaptionIndent)) \ Control(__UI_HoveringID).ItemHeight) + Control(__UI_HoveringID).InputViewStart
|
||||||
IF ThisItem% >= Control(__UI_HoveringID).Min AND ThisItem% <= Control(__UI_HoveringID).Max THEN
|
IF ThisItem% >= Control(__UI_HoveringID).Min AND ThisItem% <= Control(__UI_HoveringID).Max THEN
|
||||||
Control(__UI_HoveringID).Value = ThisItem%
|
Control(__UI_HoveringID).Value = ThisItem%
|
||||||
IF Control(__UI_HoveringID).PreviousValue <> Control(__UI_HoveringID).Value THEN
|
IF Control(__UI_HoveringID).PreviousValue <> Control(__UI_HoveringID).Value THEN
|
||||||
|
@ -2678,7 +2679,7 @@ SUB __UI_EventDispatcher
|
||||||
END IF
|
END IF
|
||||||
ELSE
|
ELSE
|
||||||
_FONT Control(__UI_HoveringID).Font
|
_FONT Control(__UI_HoveringID).Font
|
||||||
ThisItem% = ((__UI_MouseTop - (ContainerOffsetTop + Control(__UI_HoveringID).Top)) \ uspacing&) + Control(__UI_HoveringID).InputViewStart
|
ThisItem% = ((__UI_MouseTop - (ContainerOffsetTop + Control(__UI_HoveringID).Top)) \ Control(__UI_HoveringID).ItemHeight) + Control(__UI_HoveringID).InputViewStart
|
||||||
IF ThisItem% >= Control(__UI_HoveringID).Min AND ThisItem% <= Control(__UI_HoveringID).Max THEN
|
IF ThisItem% >= Control(__UI_HoveringID).Min AND ThisItem% <= Control(__UI_HoveringID).Max THEN
|
||||||
Control(__UI_HoveringID).Value = ThisItem%
|
Control(__UI_HoveringID).Value = ThisItem%
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -3674,7 +3675,7 @@ SUB __UI_EventDispatcher
|
||||||
END IF
|
END IF
|
||||||
END SELECT
|
END SELECT
|
||||||
CASE __UI_Type_ListBox, __UI_Type_DropdownList
|
CASE __UI_Type_ListBox, __UI_Type_DropdownList
|
||||||
DIM ThisItemTop%, CaptionIndent AS INTEGER
|
DIM CaptionIndent AS INTEGER
|
||||||
IF NOT Control(__UI_Focus).Disabled AND Control(__UI_Focus).Max > 0 THEN
|
IF NOT Control(__UI_Focus).Disabled AND Control(__UI_Focus).Max > 0 THEN
|
||||||
_FONT (Control(__UI_Focus).Font)
|
_FONT (Control(__UI_Focus).Font)
|
||||||
SELECT EVERYCASE __UI_KeyHit
|
SELECT EVERYCASE __UI_KeyHit
|
||||||
|
@ -5204,8 +5205,8 @@ SUB AddItem (WhichListBox AS LONG, TempItem$)
|
||||||
BorderOffset = ABS(Control(ThisID).HasBorder) * 5
|
BorderOffset = ABS(Control(ThisID).HasBorder) * 5
|
||||||
|
|
||||||
_FONT Control(ThisID).Font
|
_FONT Control(ThisID).Font
|
||||||
IF Control(ThisID).Max > FIX((Control(ThisID).Height - BorderOffset) \ uspacing) THEN
|
IF Control(ThisID).Max > FIX((Control(ThisID).Height - BorderOffset) \ Control(ThisID).ItemHeight) THEN
|
||||||
Control(ThisID).InputViewStart = Control(ThisID).Max - FIX((Control(ThisID).Height - BorderOffset) \ uspacing) + 1
|
Control(ThisID).InputViewStart = Control(ThisID).Max - FIX((Control(ThisID).Height - BorderOffset) \ Control(ThisID).ItemHeight) + 1
|
||||||
END IF
|
END IF
|
||||||
_FONT prevFont
|
_FONT prevFont
|
||||||
END IF
|
END IF
|
||||||
|
@ -5612,7 +5613,7 @@ SUB __UI_ActivateDropdownlist (This AS __UI_ControlTYPE)
|
||||||
IF This.Max > 14 THEN MaxVisible = 14 ELSE MaxVisible = This.Max
|
IF This.Max > 14 THEN MaxVisible = 14 ELSE MaxVisible = This.Max
|
||||||
|
|
||||||
_FONT This.Font
|
_FONT This.Font
|
||||||
Control(__UI_ActiveDropdownList).Height = uspacing& * (MaxVisible + .5)
|
Control(__UI_ActiveDropdownList).Height = (falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3) * (MaxVisible + .5)
|
||||||
|
|
||||||
IF Control(__UI_ActiveDropdownList).Top + Control(__UI_ActiveDropdownList).Height > Control(__UI_FormID).Height THEN
|
IF Control(__UI_ActiveDropdownList).Top + Control(__UI_ActiveDropdownList).Height > Control(__UI_FormID).Height THEN
|
||||||
Control(__UI_ActiveDropdownList).Top = Control(__UI_FormID).Height - Control(__UI_ActiveDropdownList).Height
|
Control(__UI_ActiveDropdownList).Top = Control(__UI_FormID).Height - Control(__UI_ActiveDropdownList).Height
|
||||||
|
|
|
@ -1014,8 +1014,10 @@ SUB __UI_DrawListBox (This AS __UI_ControlTYPE, ControlState)
|
||||||
|
|
||||||
IF LEN(Text(This.ID)) THEN
|
IF LEN(Text(This.ID)) THEN
|
||||||
DIM TempText$, FindLF&, ThisItem%, ThisItemTop%
|
DIM TempText$, FindLF&, ThisItem%, ThisItemTop%
|
||||||
DIM LastVisibleItem AS INTEGER
|
DIM ItemHeight AS INTEGER, LastVisibleItem AS INTEGER
|
||||||
|
|
||||||
|
ItemHeight = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3
|
||||||
|
This.ItemHeight = ItemHeight
|
||||||
TempText$ = __UI_TrimAt0$(Text(This.ID))
|
TempText$ = __UI_TrimAt0$(Text(This.ID))
|
||||||
ThisItem% = 0
|
ThisItem% = 0
|
||||||
DO WHILE LEN(TempText$)
|
DO WHILE LEN(TempText$)
|
||||||
|
@ -1029,8 +1031,8 @@ SUB __UI_DrawListBox (This AS __UI_ControlTYPE, ControlState)
|
||||||
TempText$ = ""
|
TempText$ = ""
|
||||||
END IF
|
END IF
|
||||||
IF ThisItem% >= This.InputViewStart THEN
|
IF ThisItem% >= This.InputViewStart THEN
|
||||||
ThisItemTop% = ((ThisItem% - This.InputViewStart + 1) * uspacing& - uspacing&) + CaptionIndent
|
ThisItemTop% = ((ThisItem% - This.InputViewStart + 1) * ItemHeight - ItemHeight) + CaptionIndent
|
||||||
IF ThisItemTop% + uspacing& > This.Height THEN EXIT DO
|
IF ThisItemTop% + ItemHeight > This.Height THEN EXIT DO
|
||||||
LastVisibleItem = LastVisibleItem + 1
|
LastVisibleItem = LastVisibleItem + 1
|
||||||
|
|
||||||
IF ThisItem% = This.Value AND __UI_Focus = This.ID THEN Caption(This.ID) = TempCaption$
|
IF ThisItem% = This.Value AND __UI_Focus = This.ID THEN Caption(This.ID) = TempCaption$
|
||||||
|
@ -1044,19 +1046,19 @@ SUB __UI_DrawListBox (This AS __UI_ControlTYPE, ControlState)
|
||||||
IF ThisItem% = This.Value THEN
|
IF ThisItem% = This.Value THEN
|
||||||
IF __UI_Focus = This.ID THEN
|
IF __UI_Focus = This.ID THEN
|
||||||
COLOR This.SelectedForeColor, This.SelectedBackColor
|
COLOR This.SelectedForeColor, This.SelectedBackColor
|
||||||
LINE (CaptionIndent, ThisItemTop% - 1)-STEP(This.Width - CaptionIndent * 2, uspacing&), This.SelectedBackColor, BF
|
LINE (CaptionIndent, ThisItemTop% - 1)-STEP(This.Width - CaptionIndent * 2, ItemHeight), This.SelectedBackColor, BF
|
||||||
ELSE
|
ELSE
|
||||||
LINE (CaptionIndent, ThisItemTop% - 1)-STEP(This.Width - CaptionIndent * 2, uspacing&), _RGBA32(0, 0, 0, 50), BF
|
LINE (CaptionIndent, ThisItemTop% - 1)-STEP(This.Width - CaptionIndent * 2, ItemHeight), _RGBA32(0, 0, 0, 50), BF
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
SELECT CASE This.Align
|
SELECT CASE This.Align
|
||||||
CASE __UI_Left
|
CASE __UI_Left
|
||||||
__UI_PrintString CaptionIndent * 2, ThisItemTop%, TempCaption$
|
__UI_PrintString CaptionIndent * 2, ThisItemTop% + ((ItemHeight - uspacing&) / 2), TempCaption$
|
||||||
CASE __UI_Center
|
CASE __UI_Center
|
||||||
__UI_PrintString (This.Width \ 2 - __UI_PrintWidth(TempCaption$) \ 2), ThisItemTop%, TempCaption$
|
__UI_PrintString (This.Width \ 2 - __UI_PrintWidth(TempCaption$) \ 2), ThisItemTop% + ((ItemHeight - uspacing&) / 2), TempCaption$
|
||||||
CASE __UI_Right
|
CASE __UI_Right
|
||||||
__UI_PrintString (This.Width - __UI_PrintWidth(TempCaption$)) - CaptionIndent, ThisItemTop%, TempCaption$
|
__UI_PrintString (This.Width - __UI_PrintWidth(TempCaption$)) - CaptionIndent, ThisItemTop% + ((ItemHeight - uspacing&) / 2), TempCaption$
|
||||||
END SELECT
|
END SELECT
|
||||||
END IF
|
END IF
|
||||||
LOOP
|
LOOP
|
||||||
|
|
Loading…
Reference in a new issue