mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 11:59:34 +00:00
Fixed lag when text longer than label width is displayed (ClipText$)
This commit is contained in:
parent
a19eabbb50
commit
e59858fb92
1 changed files with 21 additions and 14 deletions
35
UI.bas
35
UI.bas
|
@ -726,10 +726,7 @@ SUB __UI_UpdateDisplay
|
||||||
ContainerOffsetLeft = 0
|
ContainerOffsetLeft = 0
|
||||||
FOR i = 1 TO UBOUND(__UI_Controls)
|
FOR i = 1 TO UBOUND(__UI_Controls)
|
||||||
IF __UI_Controls(i).ID THEN
|
IF __UI_Controls(i).ID THEN
|
||||||
TempCaption$ = __UI_Captions(i)
|
TempCaption$ = __UI_ClipText(__UI_Captions(i), __UI_Controls(i).Width)
|
||||||
DO WHILE _PRINTWIDTH(TempCaption$) > __UI_Controls(i).Width
|
|
||||||
TempCaption$ = MID$(TempCaption$, 1, LEN(TempCaption$) - 1)
|
|
||||||
LOOP
|
|
||||||
|
|
||||||
IF __UI_Controls(i).ParentID THEN
|
IF __UI_Controls(i).ParentID THEN
|
||||||
_DEST __UI_Controls(__UI_Controls(i).ParentID).Canvas
|
_DEST __UI_Controls(__UI_Controls(i).ParentID).Canvas
|
||||||
|
@ -996,9 +993,7 @@ SUB __UI_UpdateDisplay
|
||||||
LastVisibleItem = LastVisibleItem + 1
|
LastVisibleItem = LastVisibleItem + 1
|
||||||
|
|
||||||
IF ThisItem% = __UI_Controls(i).Value AND __UI_Focus = i THEN __UI_SelectedText = TempCaption$
|
IF ThisItem% = __UI_Controls(i).Value AND __UI_Focus = i THEN __UI_SelectedText = TempCaption$
|
||||||
DO WHILE _PRINTWIDTH(TempCaption$) > __UI_Controls(i).Width - CaptionIndent * 2
|
TempCaption$ = __UI_ClipText(TempCaption$, __UI_Controls(i).Width - CaptionIndent * 2)
|
||||||
TempCaption$ = MID$(TempCaption$, 1, LEN(TempCaption$) - 1)
|
|
||||||
LOOP
|
|
||||||
|
|
||||||
IF __UI_Controls(i).Enabled THEN
|
IF __UI_Controls(i).Enabled THEN
|
||||||
COLOR __UI_Controls(i).ForeColor, __UI_Controls(i).BackColor
|
COLOR __UI_Controls(i).ForeColor, __UI_Controls(i).BackColor
|
||||||
|
@ -1045,10 +1040,7 @@ SUB __UI_UpdateDisplay
|
||||||
|
|
||||||
IF NoMoreChildren THEN
|
IF NoMoreChildren THEN
|
||||||
_DEST 0
|
_DEST 0
|
||||||
TempCaption$ = __UI_Captions(ThisParent)
|
TempCaption$ = __UI_ClipText(__UI_Captions(ThisParent), __UI_Controls(ThisParent).Width)
|
||||||
DO WHILE _PRINTWIDTH(TempCaption$) > __UI_Controls(ThisParent).Width
|
|
||||||
TempCaption$ = MID$(TempCaption$, 1, LEN(TempCaption$) - 1)
|
|
||||||
LOOP
|
|
||||||
|
|
||||||
_FONT __UI_Fonts(__UI_Controls(ThisParent).Font)
|
_FONT __UI_Fonts(__UI_Controls(ThisParent).Font)
|
||||||
|
|
||||||
|
@ -1910,9 +1902,7 @@ SUB __UI_DrawProgressBar (ProgressBar AS ObjectTYPE)
|
||||||
IF ReplaceCode% THEN
|
IF ReplaceCode% THEN
|
||||||
TempCaption$ = LEFT$(TempCaption$, ReplaceCode% - 1) + ProgressString$ + MID$(TempCaption$, ReplaceCode% + 2)
|
TempCaption$ = LEFT$(TempCaption$, ReplaceCode% - 1) + ProgressString$ + MID$(TempCaption$, ReplaceCode% + 2)
|
||||||
END IF
|
END IF
|
||||||
DO WHILE _PRINTWIDTH(TempCaption$) > ProgressBar.Width
|
TempCaption$ = __UI_ClipText(TempCaption$, ProgressBar.Width)
|
||||||
TempCaption$ = MID$(TempCaption$, 1, LEN(TempCaption$) - 1)
|
|
||||||
LOOP
|
|
||||||
ELSE
|
ELSE
|
||||||
TempCaption$ = ProgressString$
|
TempCaption$ = ProgressString$
|
||||||
END IF
|
END IF
|
||||||
|
@ -1942,3 +1932,20 @@ SUB __UI_AddListBoxItem (WhichListBox$, Item$)
|
||||||
__UI_Texts(ThisID) = __UI_Texts(ThisID) + Item$ + CHR$(13)
|
__UI_Texts(ThisID) = __UI_Texts(ThisID) + Item$ + CHR$(13)
|
||||||
__UI_Controls(ThisID).Max = __UI_Controls(ThisID).Max + 1
|
__UI_Controls(ThisID).Max = __UI_Controls(ThisID).Max + 1
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
'---------------------------------------------------------------------------------
|
||||||
|
FUNCTION __UI_ClipText$ (Text AS STRING, Width AS INTEGER)
|
||||||
|
DIM ClipTextLen
|
||||||
|
IF _PRINTWIDTH(Text) > Width THEN
|
||||||
|
DO
|
||||||
|
ClipTextLen = ClipTextLen + 1
|
||||||
|
IF _PRINTWIDTH(LEFT$(Text, ClipTextLen)) > Width THEN
|
||||||
|
__UI_ClipText$ = LEFT$(Text, ClipTextLen - 1)
|
||||||
|
EXIT FUNCTION
|
||||||
|
END IF
|
||||||
|
LOOP
|
||||||
|
ELSE
|
||||||
|
__UI_ClipText$ = Text
|
||||||
|
END IF
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue