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

Allows DropdownLists to have .Value = 0.

This commit is contained in:
FellippeHeitor 2018-05-14 00:36:43 -03:00
parent 8bc607af44
commit 20e8185a35
2 changed files with 38 additions and 37 deletions

View file

@ -839,7 +839,6 @@ SUB __UI_UpdateDisplay
__UI_DrawListBox Control(i), ControlState __UI_DrawListBox Control(i), ControlState
CASE __UI_Type_DropdownList CASE __UI_Type_DropdownList
'Dropdown lists 'Dropdown lists
IF Control(i).Value = 0 THEN Control(i).Value = 1
__UI_DrawDropdownList Control(i), ControlState __UI_DrawDropdownList Control(i), ControlState
CASE __UI_Type_MenuBar CASE __UI_Type_MenuBar

View file

@ -1219,46 +1219,48 @@ SUB __UI_DrawDropdownList (This AS __UI_ControlTYPE, ControlState)
DIM TempText$, ThisItem%, FindLF&, ThisItemTop% DIM TempText$, ThisItem%, FindLF&, ThisItemTop%
IF LEN(Text(This.ID)) THEN IF This.Value > 0 THEN
TempText$ = Text(This.ID) IF LEN(Text(This.ID)) THEN
ThisItem% = 0 TempText$ = Text(This.ID)
DO WHILE LEN(TempText$) ThisItem% = 0
ThisItem% = ThisItem% + 1 DO WHILE LEN(TempText$)
FindLF& = INSTR(TempText$, CHR$(13)) ThisItem% = ThisItem% + 1
IF FindLF& THEN FindLF& = INSTR(TempText$, CHR$(13))
TempCaption$ = LEFT$(TempText$, FindLF& - 1) IF FindLF& THEN
TempText$ = MID$(TempText$, FindLF& + 1) TempCaption$ = LEFT$(TempText$, FindLF& - 1)
ELSE TempText$ = MID$(TempText$, FindLF& + 1)
TempCaption$ = TempText$
TempText$ = ""
END IF
IF ThisItem% = This.Value THEN
ThisItemTop% = This.Height \ 2 - uspacing& \ 2 + 1
IF ThisItem% = This.Value AND __UI_Focus = This.ID THEN Caption(This.ID) = TempCaption$
IF NOT This.Disabled THEN
COLOR This.ForeColor
ELSE ELSE
COLOR Darken(Control(__UI_FormID).BackColor, 80) TempCaption$ = TempText$
TempText$ = ""
END IF END IF
IF ThisItem% = This.Value THEN
ThisItemTop% = This.Height \ 2 - uspacing& \ 2 + 1
IF __UI_Focus = This.ID THEN IF ThisItem% = This.Value AND __UI_Focus = This.ID THEN Caption(This.ID) = TempCaption$
COLOR This.SelectedForeColor
LINE (CaptionIndent, 3)-STEP(This.Width - CaptionIndent * 2, This.Height - 7), This.SelectedBackColor, BF IF NOT This.Disabled THEN
COLOR This.ForeColor
ELSE
COLOR Darken(Control(__UI_FormID).BackColor, 80)
END IF
IF __UI_Focus = This.ID THEN
COLOR This.SelectedForeColor
LINE (CaptionIndent, 3)-STEP(This.Width - CaptionIndent * 2, This.Height - 7), This.SelectedBackColor, BF
END IF
SELECT CASE This.Align
CASE __UI_Left
__UI_PrintString CaptionIndent * 2, ThisItemTop%, TempCaption$
CASE __UI_Center
__UI_PrintString (This.Width \ 2 - __UI_PrintWidth(TempCaption$) \ 2), ThisItemTop%, TempCaption$
CASE __UI_Right
__UI_PrintString (This.Width - __UI_PrintWidth(TempCaption$)) - CaptionIndent, ThisItemTop%, TempCaption$
END SELECT
EXIT DO
END IF END IF
LOOP
SELECT CASE This.Align END IF
CASE __UI_Left
__UI_PrintString CaptionIndent * 2, ThisItemTop%, TempCaption$
CASE __UI_Center
__UI_PrintString (This.Width \ 2 - __UI_PrintWidth(TempCaption$) \ 2), ThisItemTop%, TempCaption$
CASE __UI_Right
__UI_PrintString (This.Width - __UI_PrintWidth(TempCaption$)) - CaptionIndent, ThisItemTop%, TempCaption$
END SELECT
EXIT DO
END IF
LOOP
END IF END IF
'Draw "dropdown" button 'Draw "dropdown" button