From 1a36eabc7c80e44fc1eb72f9ed7ed3cfc802fb76 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Mon, 27 Aug 2018 01:39:20 -0300 Subject: [PATCH] Adds .BorderThickness, ranging 1-10; Also: - Fixes color preview not being dynamically updated. --- InForm/InForm.ui | 9 ++- InForm/UiEditor.bas | 120 ++++++++++++++++++++++++---------- InForm/UiEditor.frm | 16 ++++- InForm/UiEditorPreview.bas | 49 +++++++++++++- InForm/docs/frmbin format.txt | 1 + InForm/xp.uitheme | 10 +-- 6 files changed, 158 insertions(+), 47 deletions(-) diff --git a/InForm/InForm.ui b/InForm/InForm.ui index e557db2..5c50792 100644 --- a/InForm/InForm.ui +++ b/InForm/InForm.ui @@ -60,6 +60,7 @@ TYPE __UI_ControlTYPE SelectedBackColor AS _UNSIGNED LONG BackStyle AS _BYTE HasBorder AS _BYTE + BorderThickness AS INTEGER Padding AS INTEGER Encoding AS LONG Align AS _BYTE @@ -165,6 +166,7 @@ DIM SHARED __UI_PrevMouseLeft AS INTEGER, __UI_PrevMouseTop AS INTEGER DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG +DIM SHARED __UI_PreviousMouseDownOnID AS LONG DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$ @@ -211,7 +213,7 @@ DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER -DIM SHARED __UI_KeepScreenHidden AS _BYTE +DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderThickness AS INTEGER 'Control types: ----------------------------------------------- DIM SHARED __UI_Type(0 TO 18) AS __UI_Types @@ -286,6 +288,7 @@ CONST True = -1, False = 0 '$INCLUDE:'InFormVersion.bas' __UI_SnapDistance = 5 __UI_SnapDistanceFromForm = 10 +__UI_MaxBorderThickness = 10 __UI_Font8Offset = 5 __UI_Font16Offset = 3 __UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10) @@ -1573,7 +1576,7 @@ END FUNCTION SUB __UI_EventDispatcher STATIC __UI_LastMouseIconSet AS _BYTE - STATIC __UI_PreviousMouseDownOnID AS LONG, __UI_LastMouseDownEvent AS DOUBLE + STATIC __UI_LastMouseDownEvent AS DOUBLE STATIC __UI_MouseDownTop AS INTEGER, __UI_MouseDownLeft AS INTEGER STATIC __UI_JustOpenedMenu AS _BYTE STATIC ControlClipboard$ @@ -4507,6 +4510,7 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt IF (ControlType = __UI_Type_PictureBox AND __UI_DesignMode) OR ControlType = __UI_Type_TextBox OR ControlType = __UI_Type_Frame OR ControlType = __UI_Type_ListBox OR ControlType = __UI_Type_DropdownList THEN Control(NextSlot).HasBorder = True + Control(NextSlot).BorderThickness = 1 END IF IF ControlType = __UI_Type_PictureBox THEN @@ -5451,6 +5455,7 @@ SUB __UI_ActivateDropdownlist (This AS __UI_ControlTYPE) Control(__UI_ActiveDropdownList).SelectedBackColor = This.SelectedBackColor Control(__UI_ActiveDropdownList).Font = This.Font Control(__UI_ActiveDropdownList).HasBorder = True + Control(__UI_ActiveDropdownList).BorderThickness = 1 Control(__UI_ActiveDropdownList).BorderColor = _RGB32(0, 0, 0) Control(__UI_ActiveDropdownList).CanHaveFocus = True Control(__UI_ActiveDropdownList).InputViewStart = 1 diff --git a/InForm/UiEditor.bas b/InForm/UiEditor.bas index b09c931..27f1641 100644 --- a/InForm/UiEditor.bas +++ b/InForm/UiEditor.bas @@ -71,7 +71,7 @@ DIM SHARED WordWrap AS LONG, CanHaveFocus AS LONG DIM SHARED Disabled AS LONG, Transparent AS LONG DIM SHARED Hidden AS LONG, CenteredWindow AS LONG DIM SHARED Resizable AS LONG, AutoScroll AS LONG -DIM SHARED AutoSize AS LONG +DIM SHARED AutoSize AS LONG, ThicknessTB AS LONG 'Open dialog DIM SHARED DialogBG AS LONG, FileNameLB AS LONG @@ -135,9 +135,14 @@ TYPE newInputBox LabelID AS LONG Signal AS INTEGER LastEdited AS SINGLE + DataType AS INTEGER Sent AS _BYTE END TYPE +CONST DT_Text = 1 +CONST DT_Integer = 2 +CONST DT_Float = 3 + REDIM SHARED PreviewCaptions(0) AS STRING REDIM SHARED PreviewTexts(0) AS STRING REDIM SHARED PreviewMasks(0) AS STRING @@ -742,7 +747,7 @@ END SUB SUB __UI_FocusIn (id AS LONG) SELECT CASE id - CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, ThicknessTB DIM ThisInputBox AS LONG ThisInputBox = GetInputBoxFromID(id) InputBoxText(ThisInputBox) = Text(id) @@ -765,7 +770,7 @@ END SUB SUB __UI_FocusOut (id AS LONG) SELECT CASE id - CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, ThicknessTB ConfirmEdits id END SELECT END SUB @@ -890,6 +895,24 @@ SUB __UI_BeforeUpdateDisplay IF Caption(StatusBar) = "" THEN Caption(StatusBar) = "Ready." END IF + IF __UI_MouseDownOnID = Red OR __UI_MouseDownOnID = Green OR __UI_MouseDownOnID = Blue OR _ + __UI_PreviousMouseDownOnID = Red OR __UI_PreviousMouseDownOnID = Green OR __UI_PreviousMouseDownOnID = Blue THEN + + SELECT CASE __UI_MouseDownOnID + __UI_PreviousMouseDownOnID + CASE Red + Text(RedValue) = LTRIM$(STR$(FIX(Control(Red).Value))) + CASE Green + Text(GreenValue) = LTRIM$(STR$(FIX(Control(Green).Value))) + CASE Blue + Text(BlueValue) = LTRIM$(STR$(FIX(Control(Blue).Value))) + END SELECT + + 'Compose a new color and preview it + DIM NewColor AS _UNSIGNED LONG + NewColor = _RGB32(Control(Red).Value, Control(Green).Value, Control(Blue).Value) + QuickColorPreview NewColor + END IF + 'Check if another instance was launched and is passing 'parameters: STATIC BringToFront AS _BYTE, InstanceStream$ @@ -1374,11 +1397,11 @@ SUB __UI_BeforeUpdateDisplay IF __UI_Focus = InputBox(i).ID THEN Control(InputBox(i).ID).Height = 22 Control(InputBox(i).ID).BorderColor = _RGB32(0, 0, 0) - Control(InputBox(i).ID).HasBorder = 1 + Control(InputBox(i).ID).BorderThickness = 2 ELSE Control(InputBox(i).ID).Height = 23 Control(InputBox(i).ID).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Control(InputBox(i).ID).HasBorder = True + Control(InputBox(i).ID).BorderThickness = 1 END IF NEXT Control(FontSizeList).Hidden = True @@ -1673,6 +1696,22 @@ SUB __UI_BeforeUpdateDisplay END IF END IF END IF + IF __UI_Focus <> ThicknessTB OR (__UI_Focus = ThicknessTB AND RevertEdit = True) THEN + Text(ThicknessTB) = LTRIM$(STR$(PreviewControls(FirstSelected).BorderThickness)) + IF (__UI_Focus = ThicknessTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = ThicknessTB THEN + IF PropertyFullySelected(ThicknessTB) THEN + IF Text(ThicknessTB) = LTRIM$(STR$(PreviewControls(FirstSelected).BorderThickness)) THEN + Control(__UI_Focus).BorderColor = ShadeOfGreen + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN + Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) + ELSE + Control(__UI_Focus).BorderColor = ShadeOfRed + END IF + END IF + END IF + END IF END IF Control(TextTB).Max = 0 @@ -1709,6 +1748,7 @@ SUB __UI_BeforeUpdateDisplay Caption(TextLB) = "Text" Caption(ValueLB) = "Value" Caption(MaxLB) = "Max" + Control(ThicknessTB).Disabled = True IF TotalSelected > 0 THEN SELECT EVERYCASE PreviewControls(FirstSelected).Type CASE __UI_Type_ToggleSwitch @@ -1936,6 +1976,9 @@ SUB __UI_BeforeUpdateDisplay LastTopForInputBox = -12 CONST TopIncrementForInputBox = 22 FOR i = 1 TO UBOUND(InputBox) + 'Exception for ThicknessTB: + IF InputBox(i).ID = ThicknessTB THEN _CONTINUE + IF Control(InputBox(i).ID).Disabled THEN Control(InputBox(i).ID).Hidden = True Control(InputBox(i).LabelID).Hidden = True @@ -1955,7 +1998,12 @@ SUB __UI_BeforeUpdateDisplay Control(Toggles(i)).Top = LastTopForInputBox END IF NEXT + + 'Custom cases Control(AutoSize).Disabled = Control(WordWrap).Value + Control(ThicknessTB).Disabled = NOT Control(HasBorder).Value + Control(ThicknessTB).Hidden = Control(ThicknessTB).Disabled + Control(ThicknessTB).Top = Control(HasBorder).Top Control(FontSizeList).Disabled = Control(FontList).Disabled Control(FontSizeList).Hidden = Control(FontList).Hidden @@ -2389,27 +2437,28 @@ SUB __UI_OnLoad 'Assign InputBox IDs: i = 0 - i = i + 1: InputBox(i).ID = NameTB: InputBox(i).LabelID = NameLB: InputBox(i).Signal = 1 - i = i + 1: InputBox(i).ID = CaptionTB: InputBox(i).LabelID = CaptionLB: InputBox(i).Signal = 2 - i = i + 1: InputBox(i).ID = TextTB: InputBox(i).LabelID = TextLB: InputBox(i).Signal = 3 - i = i + 1: InputBox(i).ID = MaskTB: InputBox(i).LabelID = MaskLB: InputBox(i).Signal = 35 - i = i + 1: InputBox(i).ID = TopTB: InputBox(i).LabelID = TopLB: InputBox(i).Signal = 4 - i = i + 1: InputBox(i).ID = LeftTB: InputBox(i).LabelID = LeftLB: InputBox(i).Signal = 5 - i = i + 1: InputBox(i).ID = WidthTB: InputBox(i).LabelID = WidthLB: InputBox(i).Signal = 6 - i = i + 1: InputBox(i).ID = HeightTB: InputBox(i).LabelID = HeightLB: InputBox(i).Signal = 7 - i = i + 1: InputBox(i).ID = FontTB: InputBox(i).LabelID = FontLB: InputBox(i).Signal = 8 - i = i + 1: InputBox(i).ID = FontList: InputBox(i).LabelID = FontListLB: InputBox(i).Signal = 8 - i = i + 1: InputBox(i).ID = TooltipTB: InputBox(i).LabelID = TooltipLB: InputBox(i).Signal = 9 - i = i + 1: InputBox(i).ID = ValueTB: InputBox(i).LabelID = ValueLB: InputBox(i).Signal = 10 - i = i + 1: InputBox(i).ID = BooleanOptions: InputBox(i).LabelID = BooleanLB: InputBox(i).Signal = 10 - i = i + 1: InputBox(i).ID = MinTB: InputBox(i).LabelID = MinLB: InputBox(i).Signal = 11 - i = i + 1: InputBox(i).ID = MaxTB: InputBox(i).LabelID = MaxLB: InputBox(i).Signal = 12 - i = i + 1: InputBox(i).ID = IntervalTB: InputBox(i).LabelID = IntervalLB: InputBox(i).Signal = 13 - i = i + 1: InputBox(i).ID = MinIntervalTB: InputBox(i).LabelID = MinIntervalLB: InputBox(i).Signal = 36 - i = i + 1: InputBox(i).ID = PaddingTB: InputBox(i).LabelID = PaddingLeftrightLB: InputBox(i).Signal = 31 + i = i + 1: InputBox(i).ID = NameTB: InputBox(i).LabelID = NameLB: InputBox(i).Signal = 1: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = CaptionTB: InputBox(i).LabelID = CaptionLB: InputBox(i).Signal = 2: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = TextTB: InputBox(i).LabelID = TextLB: InputBox(i).Signal = 3: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = MaskTB: InputBox(i).LabelID = MaskLB: InputBox(i).Signal = 35: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = TopTB: InputBox(i).LabelID = TopLB: InputBox(i).Signal = 4: InputBox(i).DataType = DT_Integer + i = i + 1: InputBox(i).ID = LeftTB: InputBox(i).LabelID = LeftLB: InputBox(i).Signal = 5: InputBox(i).DataType = DT_Integer + i = i + 1: InputBox(i).ID = WidthTB: InputBox(i).LabelID = WidthLB: InputBox(i).Signal = 6: InputBox(i).DataType = DT_Integer + i = i + 1: InputBox(i).ID = HeightTB: InputBox(i).LabelID = HeightLB: InputBox(i).Signal = 7: InputBox(i).DataType = DT_Integer + i = i + 1: InputBox(i).ID = FontTB: InputBox(i).LabelID = FontLB: InputBox(i).Signal = 8: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = FontList: InputBox(i).LabelID = FontListLB: InputBox(i).Signal = 8: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = TooltipTB: InputBox(i).LabelID = TooltipLB: InputBox(i).Signal = 9: InputBox(i).DataType = DT_Text + i = i + 1: InputBox(i).ID = ValueTB: InputBox(i).LabelID = ValueLB: InputBox(i).Signal = 10: InputBox(i).DataType = DT_Float + i = i + 1: InputBox(i).ID = BooleanOptions: InputBox(i).LabelID = BooleanLB: InputBox(i).Signal = 10: InputBox(i).DataType = DT_Float + i = i + 1: InputBox(i).ID = MinTB: InputBox(i).LabelID = MinLB: InputBox(i).Signal = 11: InputBox(i).DataType = DT_Float + i = i + 1: InputBox(i).ID = MaxTB: InputBox(i).LabelID = MaxLB: InputBox(i).Signal = 12: InputBox(i).DataType = DT_Float + i = i + 1: InputBox(i).ID = IntervalTB: InputBox(i).LabelID = IntervalLB: InputBox(i).Signal = 13: InputBox(i).DataType = DT_Float + i = i + 1: InputBox(i).ID = MinIntervalTB: InputBox(i).LabelID = MinIntervalLB: InputBox(i).Signal = 36: InputBox(i).DataType = DT_Float + i = i + 1: InputBox(i).ID = PaddingTB: InputBox(i).LabelID = PaddingLeftrightLB: InputBox(i).Signal = 31: InputBox(i).DataType = DT_Integer i = i + 1: InputBox(i).ID = AlignOptions: InputBox(i).LabelID = TextAlignLB i = i + 1: InputBox(i).ID = VAlignOptions: InputBox(i).LabelID = VerticalAlignLB i = i + 1: InputBox(i).ID = BulletOptions: InputBox(i).LabelID = BulletOptionsLB + i = i + 1: InputBox(i).ID = ThicknessTB: InputBox(i).Signal = 40: InputBox(i).DataType = DT_Integer REDIM _PRESERVE InputBox(1 TO i) AS newInputBox REDIM InputBoxText(1 TO i) AS STRING @@ -2617,7 +2666,7 @@ SUB __UI_KeyPress (id AS LONG) IF __UI_KeyHit = 27 THEN __UI_Click CloseZOrderingBT END IF - CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, ThicknessTB IF __UI_KeyHit = 13 THEN 'Send the preview the new property value ConfirmEdits id @@ -2645,15 +2694,15 @@ SUB ConfirmEdits (id AS LONG) IF InputBoxText(GetInputBoxFromID(id)) <> Text(id) AND _ InputBox(GetInputBoxFromID(id)).Sent = False THEN - TempValue = GetPropertySignal(id) - SELECT CASE TempValue - CASE 1, 2, 3, 8, 9, 35 'Name, caption, text, font, tooltips, mask + SELECT CASE InputBox(GetInputBoxFromID(id)).DataType + CASE DT_Text b$ = MKL$(LEN(Text(id))) + Text(id) - CASE 4, 5, 6, 7, 31 'Top, left, width, height, padding + CASE DT_Integer b$ = MKI$(VAL(Text(id))) - CASE 10, 11, 12, 13, 36 'Value, min, max, interval, mininterval + CASE DT_Float b$ = _MK$(_FLOAT, VAL(Text(id))) END SELECT + TempValue = GetPropertySignal(id) SendData b$, TempValue PropertySent = True SelectPropertyFully id @@ -2724,11 +2773,6 @@ SUB __UI_ValueChanged (id AS LONG) Text(GreenValue) = LTRIM$(STR$(Control(Green).Value)) CASE Blue Text(BlueValue) = LTRIM$(STR$(Control(Blue).Value)) - CASE Red, Green, Blue - 'Compose a new color and preview it - DIM NewColor AS _UNSIGNED LONG - NewColor = _RGB32(Control(Red).Value, Control(Green).Value, Control(Blue).Value) - IF __UI_MouseDownOnID = id THEN QuickColorPreview NewColor CASE ControlList Control(UpBT).Disabled = False Control(DownBT).Disabled = False @@ -2748,7 +2792,7 @@ SUB __UI_ValueChanged (id AS LONG) SendData b$, 213 CASE FileList Text(FileNameTextBox) = GetItem(FileList, Control(FileList).Value) - CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, ThicknessTB Send Client, "LOCKCONTROLS>" END SELECT END SUB @@ -3162,6 +3206,9 @@ SUB LoadPreview PreviewControls(Dummy).AutoScroll = True CASE -42 PreviewControls(Dummy).AutoSize = True + CASE -43 + b$ = ReadSequential$(FormData$, 2) + PreviewControls(Dummy).BorderThickness = CVI(b$) CASE -1 'new control EXIT DO CASE -1024 @@ -3579,6 +3626,9 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE) IF PreviewControls(i).Padding > 0 THEN PRINT #TextFileNum, " Control(__UI_NewID).Padding = " + LTRIM$(STR$(PreviewControls(i).Padding)) END IF + IF PreviewControls(i).BorderThickness > 0 THEN + PRINT #TextFileNum, " Control(__UI_NewID).BorderThickness = " + LTRIM$(STR$(PreviewControls(i).BorderThickness)) + END IF IF PreviewControls(i).Encoding > 0 THEN PRINT #TextFileNum, " Control(__UI_NewID).Encoding = " + LTRIM$(STR$(PreviewControls(i).Encoding)) END IF diff --git a/InForm/UiEditor.frm b/InForm/UiEditor.frm index 0bb5635..c8551eb 100644 --- a/InForm/UiEditor.frm +++ b/InForm/UiEditor.frm @@ -497,6 +497,15 @@ SUB __UI_LoadForm SetCaption __UI_NewID, "Has border" Control(__UI_NewID).CanHaveFocus = True + __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "ThicknessTB", 61, 20, 132, 34, __UI_GetID("ControlToggles")) + Text(__UI_NewID) = "1" + ToolTip(__UI_NewID) = "Border thickness" + Control(__UI_NewID).HasBorder = True + Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds + Control(__UI_NewID).Min = 1 + Control(__UI_NewID).Max = 10 + Control(__UI_NewID).CanHaveFocus = True + __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "ShowPercentage", 181, 20, 12, 56, __UI_GetID("ControlToggles")) SetCaption __UI_NewID, "Show percentage" Control(__UI_NewID).CanHaveFocus = True @@ -565,7 +574,7 @@ SUB __UI_LoadForm __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "RedValue", 36, 23, 530, 20, __UI_GetID("ColorMixer")) Control(__UI_NewID).BorderColor = _RGB32(255, 0, 0) - Control(__UI_NewID).HasBorder = 1 + Control(__UI_NewID).HasBorder = True Control(__UI_NewID).CanHaveFocus = True Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds Control(__UI_NewID).Min = 0 @@ -578,7 +587,7 @@ SUB __UI_LoadForm __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "GreenValue", 36, 23, 530, 70, __UI_GetID("ColorMixer")) Control(__UI_NewID).BorderColor = _RGB32(0, 180, 0) - Control(__UI_NewID).HasBorder = 1 + Control(__UI_NewID).HasBorder = True Control(__UI_NewID).CanHaveFocus = True Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds Control(__UI_NewID).Min = 0 @@ -591,7 +600,7 @@ SUB __UI_LoadForm __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "BlueValue", 36, 23, 530, 117, __UI_GetID("ColorMixer")) Control(__UI_NewID).BorderColor = _RGB32(0, 0, 255) - Control(__UI_NewID).HasBorder = 1 + Control(__UI_NewID).HasBorder = True Control(__UI_NewID).CanHaveFocus = True Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds Control(__UI_NewID).Min = 0 @@ -826,4 +835,5 @@ SUB __UI_AssignIDs PasteListBT = __UI_GetID("PasteListBT") EditMenuConvertType = __UI_GetID("EditMenuConvertType") AutoSize = __UI_GetID("AutoSize") + ThicknessTB = __UI_GetID("ThicknessTB") END SUB diff --git a/InForm/UiEditorPreview.bas b/InForm/UiEditorPreview.bas index 090f3ec..4c8492a 100644 --- a/InForm/UiEditorPreview.bas +++ b/InForm/UiEditorPreview.bas @@ -256,8 +256,9 @@ SUB __UI_BeforeUpdateDisplay END IF SELECT CASE tempType - CASE __UI_Type_ListBox - Control(TempValue).HasBorder = True + 'CASE __UI_Type_ListBox + ' Control(TempValue).HasBorder = True + ' Control(TempValue).BorderThickness = 1 CASE __UI_Type_ProgressBar SetCaption TempValue, "\#" END SELECT @@ -847,11 +848,21 @@ SUB __UI_BeforeUpdateDisplay IF TotalLockedControls THEN FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).HasBorder = CVI(b$) + IF CVI(b$) THEN + IF Control(LockedControls(j)).BorderThickness = 0 THEN + Control(LockedControls(j)).BorderThickness = 1 + END IF + END IF NEXT ELSE FOR i = 1 TO UBOUND(Control) IF Control(i).ControlIsSelected THEN Control(i).HasBorder = CVI(b$) + IF CVI(b$) THEN + IF Control(i).BorderThickness = 0 THEN + Control(i).BorderThickness = 1 + END IF + END IF END IF NEXT END IF @@ -1191,6 +1202,20 @@ SUB __UI_BeforeUpdateDisplay END IF NEXT END IF + CASE 40 'BorderThickness + b$ = ReadSequential$(Property$, 2) + TempValue = CVI(b$) + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).BorderThickness = TempValue + NEXT + ELSEIF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).BorderThickness = TempValue + END IF + NEXT + END IF CASE 201 TO 210 'Alignment commands b$ = ReadSequential$(Property$, 2) @@ -2178,6 +2203,9 @@ SUB LoadPreview (Destination AS _BYTE) IF LogFileLoad THEN PRINT #LogFileNum, "BACKSTYLE:TRANSPARENT" CASE -12 Control(TempValue).HasBorder = True + IF Control(TempValue).BorderThickness = 0 THEN + Control(TempValue).BorderThickness = 1 + END IF IF LogFileLoad THEN PRINT #LogFileNum, "HASBORDER" CASE -13 IF NOT Disk THEN b$ = ReadSequential$(Clip$, 1) ELSE b$ = SPACE$(1): GET #BinaryFileNum, , b$ @@ -2273,6 +2301,10 @@ SUB LoadPreview (Destination AS _BYTE) Control(TempValue).AutoScroll = True CASE -42 Control(TempValue).AutoSize = True + CASE -43 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + Control(TempValue).BorderThickness = CVI(b$) + IF LogFileLoad THEN PRINT #LogFileNum, "BORDER THICKNESS" + STR$(CVI(b$)) CASE -1 'new control IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL: -1" EXIT DO @@ -2473,7 +2505,12 @@ SUB LoadPreviewText Control(TempValue).BackStyle = __UI_Transparent END IF CASE "HasBorder" - Control(TempValue).HasBorder = (DummyText$ = "True") + IF DummyText$ = "True" THEN + Control(TempValue).HasBorder = True + IF Control(TempValue).BorderThickness = 0 THEN + Control(TempValue).BorderThickness = 1 + END IF + END IF CASE "Align" SELECT CASE DummyText$ CASE "__UI_Center": Control(TempValue).Align = __UI_Center @@ -2517,6 +2554,8 @@ SUB LoadPreviewText Control(TempValue).CanResize = (DummyText$ = "True") CASE "Padding" Control(TempValue).Padding = VAL(DummyText$) + CASE "BorderThickness" + Control(TempValue).BorderThickness = VAL(DummyText$) CASE "VAlign" SELECT CASE DummyText$ CASE "__UI_Middle": Control(TempValue).VAlign = __UI_Middle @@ -2996,6 +3035,10 @@ SUB SavePreview (Destination AS _BYTE) Clip$ = Clip$ + b$ END IF END IF + IF Control(i).BorderThickness > 0 THEN + b$ = MKI$(-43) + MKI$(Control(i).BorderThickness) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF END IF NEXT NEXT diff --git a/InForm/docs/frmbin format.txt b/InForm/docs/frmbin format.txt index a32af37..79d1d8e 100644 --- a/InForm/docs/frmbin format.txt +++ b/InForm/docs/frmbin format.txt @@ -78,5 +78,6 @@ FOR EACH CONTROL (FORM INCLUDED): For ListBox controls INTEGER -42 (AutoSize = True) For Label controls + INTEGER -43 (BorderThickness) + INTEGER .BorderThickness ------------------- INTEGER -1024 (End of file) \ No newline at end of file diff --git a/InForm/xp.uitheme b/InForm/xp.uitheme index 03dd51c..84a6917 100644 --- a/InForm/xp.uitheme +++ b/InForm/xp.uitheme @@ -764,7 +764,7 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A TempCaption$ = __UI_TrimAt0$(Caption(This.ID)) CaptionIndent = 0 - IF This.HasBorder THEN CaptionIndent = 5 + IF This.HasBorder THEN CaptionIndent = 5 + This.BorderThickness IF NOT This.Disabled AND (LEN(Text(This.ID)) OR This.Multiline) THEN COLOR This.ForeColor, This.BackColor @@ -934,9 +934,11 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A END IF IF This.HasBorder = True THEN - LINE (0, 0)-STEP(This.Width - 1, This.Height - 1), This.BorderColor, B - ELSEIF This.HasBorder > 0 THEN - FOR i = 0 TO This.HasBorder + IF This.BorderThickness > __UI_MaxBorderThickness THEN + This.BorderThickness = __UI_MaxBorderThickness + END IF + + FOR i = 0 TO This.BorderThickness - 1 LINE (i, i)-STEP(This.Width - 1 - i * 2, This.Height - 1 - i * 2), This.BorderColor, B NEXT END IF