mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-14 19:49:33 +00:00
Makes it possible to assign a key combo via UiEditor and +
+ also saves the new KeyCombo property to .frm files. + several internal improvements to handling of KeyCombos. + improvements to menu system in DesignMode.
This commit is contained in:
parent
795394b748
commit
0b6f6d76de
5 changed files with 219 additions and 45 deletions
117
InForm/InForm.ui
117
InForm/InForm.ui
|
@ -174,9 +174,10 @@ REDIM SHARED __UI_WordWrapHistoryResults(1 TO 100) AS STRING
|
|||
REDIM SHARED __UI_WordWrapHistory(1 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG
|
||||
REDIM SHARED __UI_ActiveMenu(0 TO 100) AS LONG, __UI_ParentMenu(0 TO 100) AS LONG
|
||||
REDIM SHARED __UI_KeyCombo(0 TO 100) AS __UI_KeyCombos, __UI_TotalKeyCombos AS LONG
|
||||
DIM SHARED table1252$(255), table437$(255)
|
||||
REDIM SHARED __UI_KeyCombo(0 TO 100) AS __UI_KeyCombos
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(255), table437$(255)
|
||||
DIM SHARED __UI_MouseLeft AS INTEGER, __UI_MouseTop AS INTEGER
|
||||
DIM SHARED __UI_MouseWheel AS INTEGER, __UI_MouseButtonsSwap AS _BYTE
|
||||
DIM SHARED __UI_PrevMouseLeft AS INTEGER, __UI_PrevMouseTop AS INTEGER
|
||||
|
@ -1270,18 +1271,24 @@ SUB __UI_UpdateDisplay
|
|||
IF Control(i).Type = __UI_Type_MenuItem THEN
|
||||
TempParentID = Control(i).ParentID
|
||||
Control(i).ParentID = Control(i).MenuPanelID
|
||||
'Dotted outline:
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left - 2, Control(i).Top + Control(Control(i).ParentID).Top - 2)-STEP(Control(Control(i).ParentID).Width + 3, Control(i).Height + 3), _RGB32(0, 0, 0), B , 21845
|
||||
ELSE
|
||||
TempParentID = 0
|
||||
'Dotted outline:
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left - 2, Control(i).Top + Control(Control(i).ParentID).Top - 2)-STEP(Control(i).Width + 3, Control(i).Height + 3), _RGB32(0, 0, 0), B , 21845
|
||||
END IF
|
||||
|
||||
'Dotted outline:
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left - 2, Control(i).Top + Control(Control(i).ParentID).Top - 2)-STEP(Control(i).Width + 3, Control(i).Height + 3), _RGB32(0, 0, 0), B , 21845
|
||||
|
||||
IF NOT __UI_IsDragging THEN
|
||||
IF __UI_Type(Control(i).Type).RestrictResize <> __UI_CantResizeH AND __UI_Type(Control(i).Type).RestrictResize <> __UI_CantResize THEN
|
||||
'Right resize handle:
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left + Control(i).Width - 8, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(255, 255, 255), BF
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left + Control(i).Width - 8, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(0, 0, 0), B
|
||||
IF Control(i).Type = __UI_Type_MenuItem THEN
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left + Control(Control(i).ParentID).Width - 8, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(255, 255, 255), BF
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left + Control(Control(i).ParentID).Width - 8, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(0, 0, 0), B
|
||||
ELSE
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left + Control(i).Width - 8, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(255, 255, 255), BF
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left + Control(i).Width - 8, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(0, 0, 0), B
|
||||
END IF
|
||||
|
||||
'Left resize handle:
|
||||
LINE (Control(i).Left + Control(Control(i).ParentID).Left, Control(i).Top + Control(Control(i).ParentID).Top + Control(i).Height / 2 - 4)-STEP(7, 7), _RGB32(255, 255, 255), BF
|
||||
|
@ -1762,9 +1769,13 @@ SUB __UI_EventDispatcher
|
|||
|
||||
IF Control(__UI_FocusSearch).ID > 0 AND Control(__UI_FocusSearch).Type <> __UI_Type_Form AND Control(__UI_FocusSearch).Type <> __UI_Type_MenuPanel AND Control(__UI_FocusSearch).Type <> __UI_Type_Font AND UCASE$(LEFT$(Control(__UI_FocusSearch).Name, 5)) <> "__UI_" THEN
|
||||
IF Control(__UI_FocusSearch).Type <> __UI_Type_MenuItem THEN
|
||||
__UI_CloseAllMenus
|
||||
__UI_TotalSelectedControls = 1
|
||||
__UI_FirstSelectedID = __UI_FocusSearch
|
||||
Control(__UI_FocusSearch).ControlIsSelected = True
|
||||
IF Control(__UI_FocusSearch).Type = __UI_Type_MenuBar OR Control(__UI_FocusSearch).Type = __UI_Type_ContextMenu THEN
|
||||
__UI_ActivateMenu Control(__UI_FocusSearch), False
|
||||
END IF
|
||||
EXIT DO
|
||||
ELSE
|
||||
IF __UI_ParentMenu(__UI_TotalActiveMenus) = Control(__UI_FocusSearch).ParentID THEN
|
||||
|
@ -3365,7 +3376,7 @@ SUB __UI_EventDispatcher
|
|||
|
||||
'Key combos can be associated with controls using the RegisterKeyCombo method;
|
||||
'Key combos take precedence over other keyboard events:
|
||||
IF __UI_DesignMode = False AND __UI_AltIsDown = False AND __UI_KeyHit > 0 AND __UI_TotalActiveMenus = 0 THEN
|
||||
IF __UI_BypassKeyCombos = False AND __UI_DesignMode = False AND __UI_AltIsDown = False AND __UI_KeyHit > 0 AND __UI_TotalActiveMenus = 0 THEN
|
||||
DIM ComboKey AS STRING
|
||||
DIM tempCombo$
|
||||
|
||||
|
@ -4411,8 +4422,23 @@ END FUNCTION
|
|||
|
||||
'---------------------------------------------------------------------------------
|
||||
FUNCTION RegisterKeyCombo (__Combo$, id AS LONG)
|
||||
DIM i AS LONG, Combo$
|
||||
IF LEN(LTRIM$(RTRIM$(__Combo$))) = 0 THEN EXIT FUNCTION
|
||||
DIM i AS LONG, j AS LONG, Combo$
|
||||
|
||||
IF Control(id).ID = 0 THEN EXIT FUNCTION
|
||||
|
||||
IF LEN(LTRIM$(RTRIM$(__Combo$))) = 0 THEN
|
||||
IF id > 0 THEN
|
||||
'delete assignment
|
||||
FOR i = 1 TO __UI_TotalKeyCombos
|
||||
IF __UI_KeyCombo(i).ControlID = id THEN
|
||||
Control(__UI_KeyCombo(i).ControlID).KeyCombo = 0
|
||||
__UI_KeyCombo(i).ControlID = 0
|
||||
EXIT FOR
|
||||
END IF
|
||||
NEXT
|
||||
END IF
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
|
||||
Combo$ = UCASE$(LTRIM$(RTRIM$(__Combo$)))
|
||||
IF INSTR(Combo$, "CTRL+") = 0 THEN
|
||||
|
@ -4426,13 +4452,25 @@ FUNCTION RegisterKeyCombo (__Combo$, id AS LONG)
|
|||
END IF
|
||||
|
||||
FOR i = 1 TO __UI_TotalKeyCombos
|
||||
IF RTRIM$(__UI_KeyCombo(i).Combo) = Combo$ AND __UI_KeyCombo(i).ControlID >= 0 THEN
|
||||
'Reassign combo to different control
|
||||
__UI_KeyCombo(i).ControlID = id
|
||||
RegisterKeyCombo = True
|
||||
EXIT FUNCTION
|
||||
ELSEIF RTRIM$(__UI_KeyCombo(i).Combo) = Combo$ AND __UI_KeyCombo(i).ControlID < 0 THEN
|
||||
EXIT FUNCTION
|
||||
IF RTRIM$(__UI_KeyCombo(i).Combo) = Combo$ THEN
|
||||
IF __UI_KeyCombo(i).ControlID >= 0 THEN
|
||||
'Check if this id is already assigned to a combo
|
||||
FOR j = 1 TO __UI_TotalKeyCombos
|
||||
IF __UI_KeyCombo(j).ControlID = id THEN
|
||||
Control(__UI_KeyCombo(j).ControlID).KeyCombo = 0
|
||||
__UI_KeyCombo(j).ControlID = 0
|
||||
END IF
|
||||
NEXT
|
||||
|
||||
'Reassign combo to different control
|
||||
Control(__UI_KeyCombo(i).ControlID).KeyCombo = 0
|
||||
__UI_KeyCombo(i).ControlID = id
|
||||
Control(id).KeyCombo = i
|
||||
RegisterKeyCombo = True
|
||||
EXIT FUNCTION
|
||||
ELSE
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
|
||||
|
@ -4443,6 +4481,13 @@ FUNCTION RegisterKeyCombo (__Combo$, id AS LONG)
|
|||
__UI_TotalKeyCombos = __UI_TotalKeyCombos + 1
|
||||
__UI_KeyCombo(__UI_TotalKeyCombos).Combo = Combo$
|
||||
__UI_KeyCombo(__UI_TotalKeyCombos).FriendlyCombo = __UI_FriendlyCombo(Combo$)
|
||||
|
||||
FOR i = 1 TO __UI_TotalKeyCombos
|
||||
IF __UI_KeyCombo(i).ControlID = id THEN
|
||||
__UI_KeyCombo(i).ControlID = 0
|
||||
END IF
|
||||
NEXT
|
||||
|
||||
__UI_KeyCombo(__UI_TotalKeyCombos).ControlID = id
|
||||
Control(id).KeyCombo = __UI_TotalKeyCombos
|
||||
RegisterKeyCombo = True
|
||||
|
@ -4562,7 +4607,7 @@ FUNCTION __UI_GetID (ControlName$)
|
|||
DIM i AS LONG, ControlSearch$
|
||||
|
||||
ControlSearch$ = UCASE$(RTRIM$(ControlName$))
|
||||
|
||||
IF LEN(ControlSearch$) = 0 THEN EXIT FUNCTION
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
IF Control(i).ID > 0 AND UCASE$(RTRIM$(Control(i).Name)) = ControlSearch$ THEN
|
||||
__UI_GetID = i
|
||||
|
@ -4729,6 +4774,7 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt
|
|||
STATIC InternalMenus AS LONG, FirstControl AS _BYTE
|
||||
|
||||
IF ControlType = 0 THEN EXIT SUB
|
||||
|
||||
__UI_ExpandControlDrawOrder 1
|
||||
'Increase the global count of controls of this type
|
||||
__UI_Type(ControlType).Count = __UI_Type(ControlType).Count + 1
|
||||
|
@ -4736,6 +4782,7 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt
|
|||
'Give control a generic name, if none is provided
|
||||
IF ControlType = __UI_Type_MenuItem AND LEFT$(ControlName, 5) = "__UI_" THEN InternalMenus = InternalMenus + 1
|
||||
IF ControlType = __UI_Type_ContextMenu AND LEFT$(ControlName, 5) = "__UI_" THEN __UI_InternalContextMenus = __UI_InternalContextMenus + 1
|
||||
|
||||
IF ControlName = "" THEN
|
||||
IF ControlType = __UI_Type_MenuItem THEN
|
||||
ControlName = RTRIM$(__UI_Type(ControlType).Name) + LTRIM$(STR$(__UI_Type(ControlType).Count - InternalMenus))
|
||||
|
@ -5869,8 +5916,10 @@ END SUB
|
|||
'---------------------------------------------------------------------------------
|
||||
SUB __UI_CloseAllMenus
|
||||
DIM i AS LONG
|
||||
FOR i = 1 TO __UI_TotalActiveMenus
|
||||
__UI_DestroyControl Control(__UI_ActiveMenu(i))
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
IF Control(i).Type = __UI_Type_MenuPanel THEN
|
||||
__UI_DestroyControl Control(i)
|
||||
END IF
|
||||
NEXT
|
||||
END SUB
|
||||
|
||||
|
@ -5902,23 +5951,20 @@ SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE)
|
|||
DIM CurrentGroup AS INTEGER, ComboSpacing AS INTEGER
|
||||
|
||||
IF NOT This.Disabled THEN
|
||||
'Check that this menu hasn't yet been activated:
|
||||
FOR i = 1 TO __UI_TotalActiveMenus
|
||||
IF __UI_ParentMenu(i) = This.ID THEN
|
||||
EXIT SUB
|
||||
END IF
|
||||
NEXT
|
||||
|
||||
IF This.Type = __UI_Type_ContextMenu THEN __UI_CloseAllMenus: __UI_ForceRedraw = True
|
||||
|
||||
IF __UI_TotalActiveMenus + 1 > UBOUND(__UI_ActiveMenu) THEN
|
||||
EXIT SUB
|
||||
END IF
|
||||
__UI_TotalActiveMenus = __UI_TotalActiveMenus + 1
|
||||
__UI_ActiveMenu(__UI_TotalActiveMenus) = __UI_NewControl(__UI_Type_MenuPanel, RTRIM$(This.Name) + CHR$(254) + "Panel", 0, 0, 0, 0, 0)
|
||||
IF __UI_ActiveMenu(__UI_TotalActiveMenus) = 0 THEN
|
||||
__UI_TotalActiveMenus = __UI_TotalActiveMenus - 1
|
||||
EXIT SUB
|
||||
IF __UI_GetID(RTRIM$(This.Name) + CHR$(254) + "Panel") > 0 THEN
|
||||
__UI_ActiveMenu(__UI_TotalActiveMenus) = __UI_GetID(RTRIM$(This.Name) + CHR$(254) + "Panel")
|
||||
ELSE
|
||||
IF __UI_TotalActiveMenus + 1 > UBOUND(__UI_ActiveMenu) THEN
|
||||
EXIT SUB
|
||||
END IF
|
||||
__UI_ActiveMenu(__UI_TotalActiveMenus + 1) = __UI_NewControl(__UI_Type_MenuPanel, RTRIM$(This.Name) + CHR$(254) + "Panel", 0, 0, 0, 0, 0)
|
||||
__UI_TotalActiveMenus = __UI_TotalActiveMenus + 1
|
||||
IF __UI_ActiveMenu(__UI_TotalActiveMenus) = 0 THEN
|
||||
__UI_TotalActiveMenus = __UI_TotalActiveMenus - 1
|
||||
EXIT SUB
|
||||
END IF
|
||||
END IF
|
||||
|
||||
Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).SourceControl = This.ID
|
||||
|
@ -5947,6 +5993,7 @@ SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE)
|
|||
'Calculate panel's width and position the menu items
|
||||
ItemHeight = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3
|
||||
Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height = (((_FONT = 8) * -1) * 3 + falcon_uspacing&) / 4
|
||||
Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Width = 0
|
||||
CurrentGroup = 1
|
||||
ComboSpacing = 0
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
|
|
|
@ -127,6 +127,7 @@ DIM SHARED BooleanLB AS LONG, BooleanOptions AS LONG
|
|||
DIM SHARED FontListLB AS LONG, FontList AS LONG, FontSizeList
|
||||
DIM SHARED PasteListBT AS LONG, ContextMenuLB AS LONG
|
||||
DIM SHARED ContextMenuControlsList AS LONG
|
||||
DIM SHARED KeyboardComboLB AS LONG, KeyboardComboBT AS LONG
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
'Other shared variables:
|
||||
|
@ -168,6 +169,7 @@ REDIM SHARED PreviewActualFonts(0) AS STRING
|
|||
REDIM SHARED PreviewControls(0) AS __UI_ControlTYPE
|
||||
REDIM SHARED PreviewParentIDS(0) AS STRING
|
||||
REDIM SHARED PreviewContextMenu(0) AS STRING
|
||||
REDIM SHARED PreviewKeyCombos(0) AS STRING
|
||||
REDIM SHARED zOrderIDs(0) AS LONG
|
||||
REDIM SHARED InputBox(1 TO 100) AS newInputBox
|
||||
REDIM SHARED Toggles(1 TO 100) AS LONG
|
||||
|
@ -790,6 +792,10 @@ SUB __UI_Click (id AS LONG)
|
|||
__UI_Focus = Dummy
|
||||
Control(Dummy).Cursor = LEN(Text(Dummy))
|
||||
Control(Dummy).TextIsSelected = False
|
||||
CASE KeyboardComboBT
|
||||
__UI_BypassKeyCombos = True
|
||||
Caption(KeyboardComboBT) = CHR$(7) + " hit a key combo... (ESC to clear)"
|
||||
ToolTip(KeyboardComboBT) = "Press a key combination to assign to the selected control"
|
||||
END SELECT
|
||||
|
||||
LastClickedID = id
|
||||
|
@ -900,6 +906,10 @@ SUB __UI_FocusIn (id AS LONG)
|
|||
IF ZOrderingDialogOpen THEN __UI_Focus = ControlList
|
||||
CASE CancelBT
|
||||
IF ZOrderingDialogOpen THEN __UI_Focus = CloseZOrderingBT
|
||||
CASE KeyboardComboBT
|
||||
__UI_BypassKeyCombos = True
|
||||
Caption(KeyboardComboBT) = CHR$(7) + " hit a key combo... (ESC to clear)"
|
||||
ToolTip(KeyboardComboBT) = "Press a key combination to assign to the selected control"
|
||||
END SELECT
|
||||
END SUB
|
||||
|
||||
|
@ -907,6 +917,9 @@ 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, SizeTB
|
||||
ConfirmEdits id
|
||||
CASE KeyboardComboBT
|
||||
__UI_BypassKeyCombos = False
|
||||
Caption(KeyboardComboBT) = "Click to assign"
|
||||
END SELECT
|
||||
END SUB
|
||||
|
||||
|
@ -1071,6 +1084,22 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Control(StatusBar).Redraw = True
|
||||
END IF
|
||||
|
||||
IF __UI_BypassKeyCombos THEN
|
||||
'Blink KeyCombo button
|
||||
IF TIMER - LastChange > .4 THEN
|
||||
IF Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1) THEN
|
||||
Control(KeyboardComboBT).ForeColor = _RGB32(255, 0, 0)
|
||||
ELSE
|
||||
Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1)
|
||||
END IF
|
||||
Control(KeyboardComboBT).Redraw = True
|
||||
LastChange = TIMER
|
||||
END IF
|
||||
ELSE
|
||||
Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1)
|
||||
Control(KeyboardComboBT).Redraw = True
|
||||
END IF
|
||||
|
||||
IF RecentListBuilt = False THEN
|
||||
'Build list of recent projects
|
||||
RecentListBuilt = True
|
||||
|
@ -1978,6 +2007,13 @@ SUB __UI_BeforeUpdateDisplay
|
|||
ELSE
|
||||
Control(ContextMenuControlsList).Value = 1
|
||||
END IF
|
||||
IF __UI_BypassKeyCombos = False THEN
|
||||
IF TotalSelected = 1 AND LEN(PreviewKeyCombos(FirstSelected)) THEN
|
||||
Caption(KeyboardComboBT) = PreviewKeyCombos(FirstSelected)
|
||||
ELSE
|
||||
Caption(KeyboardComboBT) = "Click to assign"
|
||||
END IF
|
||||
END IF
|
||||
|
||||
STATIC ShowInvalidValueWarning AS _BYTE
|
||||
IF Control(__UI_Focus).BorderColor = ShadeOfRed THEN
|
||||
|
@ -2051,7 +2087,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
CASE __UI_Type_MenuItem
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
SELECT CASE InputBox(i).ID
|
||||
CASE NameTB, CaptionTB, TextTB, TooltipTB, BulletOptions, BooleanOptions
|
||||
CASE NameTB, CaptionTB, TextTB, TooltipTB, BulletOptions, BooleanOptions, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
|
@ -2103,7 +2139,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
IF PreviewControls(FirstSelected).NumericOnly = True THEN
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
SELECT CASE InputBox(i).ID
|
||||
CASE ValueTB, MinTB, MaxTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions
|
||||
CASE ValueTB, MinTB, MaxTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
|
@ -2112,7 +2148,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
ELSEIF PreviewControls(FirstSelected).NumericOnly = __UI_NumericWithBounds THEN
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
SELECT CASE InputBox(i).ID
|
||||
CASE ValueTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions
|
||||
CASE ValueTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
|
@ -2122,7 +2158,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Caption(MaxLB) = "Max length"
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
SELECT CASE InputBox(i).ID
|
||||
CASE ValueTB, MinTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions
|
||||
CASE ValueTB, MinTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
|
@ -2163,7 +2199,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
CASE __UI_Type_ProgressBar
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
SELECT CASE InputBox(i).ID
|
||||
CASE TextTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions
|
||||
CASE TextTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
|
@ -2173,7 +2209,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Control(HideTicks).Disabled = False
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
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, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
|
@ -2185,7 +2221,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
Control(Transparent).Disabled = False
|
||||
FOR i = 1 TO UBOUND(InputBox)
|
||||
SELECT CASE InputBox(i).ID
|
||||
CASE CaptionTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions
|
||||
CASE CaptionTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT
|
||||
Control(InputBox(i).ID).Disabled = True
|
||||
CASE ELSE
|
||||
Control(InputBox(i).ID).Disabled = False
|
||||
|
@ -2771,6 +2807,8 @@ SUB __UI_OnLoad
|
|||
i = i + 1: InputBox(i).ID = BulletOptions: InputBox(i).LabelID = BulletOptionsLB
|
||||
i = i + 1: InputBox(i).ID = SizeTB: InputBox(i).Signal = 40: InputBox(i).DataType = DT_Integer
|
||||
i = i + 1: InputBox(i).ID = ContextMenuControlsList: InputBox(i).LabelID = ContextMenuLB: InputBox(i).DataType = DT_Text
|
||||
i = i + 1: InputBox(i).ID = KeyboardComboBT: InputBox(i).LabelID = KeyboardComboLB: InputBox(i).DataType = DT_Text
|
||||
|
||||
REDIM _PRESERVE InputBox(1 TO i) AS newInputBox
|
||||
REDIM InputBoxText(1 TO i) AS STRING
|
||||
|
||||
|
@ -2795,6 +2833,7 @@ SUB __UI_OnLoad
|
|||
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(FontList) = "System fonts may not be available in all computers. To specify a local font file, right-click 'Font' to the left of this list and disable 'Show system fonts list'."
|
||||
ToolTip(ColorPreview) = "Click to copy the current color's hex value to the clipboard."
|
||||
ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control"
|
||||
|
||||
StatusBarBackColor = Darken(__UI_DefaultColor(__UI_Type_Form, 2), 90)
|
||||
Control(StatusBar).BackColor = StatusBarBackColor
|
||||
|
@ -2924,6 +2963,7 @@ SUB __UI_OnLoad
|
|||
END SUB
|
||||
|
||||
SUB __UI_KeyPress (id AS LONG)
|
||||
DIM i AS LONG
|
||||
LastKeyPress = TIMER
|
||||
SELECT EVERYCASE id
|
||||
CASE RedValue, GreenValue, BlueValue
|
||||
|
@ -3013,6 +3053,40 @@ SUB __UI_KeyPress (id AS LONG)
|
|||
InputBox(GetInputBoxFromID(id)).Sent = False
|
||||
Send Client, "LOCKCONTROLS><END>"
|
||||
END IF
|
||||
CASE KeyboardComboBT
|
||||
DIM Combo$
|
||||
IF __UI_CtrlIsDown THEN Combo$ = "Ctrl+"
|
||||
IF __UI_ShiftIsDown THEN Combo$ = Combo$ + "Shift+"
|
||||
SELECT CASE __UI_KeyHit
|
||||
CASE 27
|
||||
__UI_Focus = 0
|
||||
__UI_BypassKeyCombos = False
|
||||
ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control"
|
||||
SendData MKI$(0), 43
|
||||
__UI_ForceRedraw = True
|
||||
CASE __UI_FKey(1), __UI_FKey(2), __UI_FKey(3), __UI_FKey(4), __UI_FKey(5), __UI_FKey(6), _
|
||||
__UI_FKey(7), __UI_FKey(8), __UI_FKey(9), __UI_FKey(10), __UI_FKey(11), __UI_FKey(12)
|
||||
FOR i = 1 TO 12
|
||||
IF __UI_FKey(i) = __UI_KeyHit THEN
|
||||
Combo$ = Combo$ + "F" + LTRIM$(STR$(i))
|
||||
SendData MKI$(LEN(Combo$)) + Combo$, 43
|
||||
__UI_Focus = 0
|
||||
__UI_BypassKeyCombos = False
|
||||
ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control"
|
||||
__UI_ForceRedraw = True
|
||||
EXIT FOR
|
||||
END IF
|
||||
NEXT
|
||||
CASE 65 TO 90, 97 TO 122 'Alphanumeric
|
||||
Combo$ = Combo$ + UCASE$(CHR$(__UI_KeyHit))
|
||||
IF INSTR(Combo$, "Ctrl+") > 0 THEN
|
||||
SendData MKI$(LEN(Combo$)) + Combo$, 43
|
||||
__UI_Focus = 0
|
||||
__UI_BypassKeyCombos = False
|
||||
ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control"
|
||||
__UI_ForceRedraw = True
|
||||
END IF
|
||||
END SELECT
|
||||
END SELECT
|
||||
END SUB
|
||||
|
||||
|
@ -3403,6 +3477,7 @@ SUB LoadPreview
|
|||
REDIM PreviewControls(0 TO CVL(b$)) AS __UI_ControlTYPE
|
||||
REDIM PreviewParentIDS(0 TO CVL(b$)) AS STRING
|
||||
REDIM PreviewContextMenu(0 TO CVL(b$)) AS STRING
|
||||
REDIM PreviewKeyCombos(0 TO CVL(b$)) AS STRING
|
||||
|
||||
ResetList ContextMenuControlsList
|
||||
AddItem ContextMenuControlsList, "(none)"
|
||||
|
@ -3558,6 +3633,10 @@ SUB LoadPreview
|
|||
CASE -43
|
||||
b$ = ReadSequential$(FormData$, 2)
|
||||
PreviewControls(Dummy).BorderSize = CVI(b$)
|
||||
CASE -44 'Key combo
|
||||
b$ = ReadSequential$(FormData$, 2)
|
||||
b$ = ReadSequential$(FormData$, CVI(b$))
|
||||
PreviewKeyCombos(Dummy) = b$
|
||||
CASE -1 'new control
|
||||
EXIT DO
|
||||
CASE -1024
|
||||
|
@ -3805,7 +3884,7 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE)
|
|||
IF PreviewControls(PreviewFormID).CanResize THEN
|
||||
PRINT #TextFileNum, " $RESIZE:ON"
|
||||
END IF
|
||||
PRINT #TextFileNum, " DIM __UI_NewID AS LONG"
|
||||
PRINT #TextFileNum, " DIM __UI_NewID AS LONG, __UI_Dummy AS LONG"
|
||||
PRINT #TextFileNum,
|
||||
|
||||
'First pass is for the main form and containers (frames and menubars).
|
||||
|
@ -3997,6 +4076,9 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE)
|
|||
PRINT #TextFileNum, " Control(__UI_NewID).ContextMenuID = __UI_GetID(" + CHR$(34) + PreviewContextMenu(i) + CHR$(34) + ")"
|
||||
END IF
|
||||
END IF
|
||||
IF LEN(PreviewKeyCombos(i)) THEN
|
||||
PRINT #TextFileNum, " __UI_Dummy = RegisterKeyCombo(" + CHR$(34) + PreviewKeyCombos(i) + CHR$(34) + ", __UI_NewID)"
|
||||
END IF
|
||||
IF PreviewControls(i).Interval THEN
|
||||
PRINT #TextFileNum, " Control(__UI_NewID).Interval = " + LTRIM$(STR$(PreviewControls(i).Interval))
|
||||
END IF
|
||||
|
|
|
@ -533,6 +533,14 @@ SUB __UI_LoadForm
|
|||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "KeyboardComboLB", 120, 23, 10, 362, __UI_GetID("ControlProperties"))
|
||||
SetCaption __UI_NewID, "Keyboard combo"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "KeyboardComboBT", 230, 23, 129, 362, __UI_GetID("ControlProperties"))
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Stretch", 181, 20, 12, 12, __UI_GetID("ControlToggles"))
|
||||
SetCaption __UI_NewID, "Stretch"
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
@ -911,4 +919,6 @@ SUB __UI_AssignIDs
|
|||
FileMenuRecent7 = __UI_GetID("FileMenuRecent7")
|
||||
FileMenuRecent8 = __UI_GetID("FileMenuRecent8")
|
||||
FileMenuRecent9 = __UI_GetID("FileMenuRecent9")
|
||||
KeyboardComboLB = __UI_GetID("KeyboardComboLB")
|
||||
KeyboardComboBT = __UI_GetID("KeyboardComboBT")
|
||||
END SUB
|
||||
|
|
|
@ -1405,6 +1405,28 @@ SUB __UI_BeforeUpdateDisplay
|
|||
END IF
|
||||
NEXT
|
||||
END IF
|
||||
CASE 43 'Key combo
|
||||
b$ = ReadSequential$(Property$, 2)
|
||||
b$ = ReadSequential$(Property$, CVI(b$))
|
||||
IF TotalLockedControls THEN
|
||||
FOR j = 1 TO TotalLockedControls
|
||||
i = RegisterKeyCombo(b$, LockedControls(j))
|
||||
IF Control(LockedControls(j)).Type = __UI_Type_MenuItem THEN
|
||||
__UI_ActivateMenu Control(Control(LockedControls(j)).ParentID), False
|
||||
EXIT FOR
|
||||
END IF
|
||||
NEXT
|
||||
ELSE
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
IF Control(i).ControlIsSelected THEN
|
||||
j = RegisterKeyCombo(b$, Control(i).ID)
|
||||
IF Control(i).Type = __UI_Type_MenuItem THEN
|
||||
__UI_ActivateMenu Control(Control(i).ParentID), False
|
||||
EXIT FOR
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
END IF
|
||||
CASE 201 TO 210
|
||||
'Alignment commands
|
||||
b$ = ReadSequential$(Property$, 2)
|
||||
|
@ -1428,8 +1450,10 @@ SUB __UI_BeforeUpdateDisplay
|
|||
NEXT
|
||||
|
||||
IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" THEN
|
||||
IF Control(CVL(a$)).Type = __UI_Type_MenuItem OR Control(CVL(b$)).Type = __UI_Type_MenuItem THEN
|
||||
__UI_ActivateMenu Control(__UI_ParentMenu(__UI_TotalActiveMenus)), False
|
||||
IF Control(CVL(a$)).Type = __UI_Type_MenuItem THEN
|
||||
__UI_ActivateMenu Control(Control(CVL(a$)).ParentID), False
|
||||
ELSEIF Control(CVL(b$)).Type = __UI_Type_MenuItem THEN
|
||||
__UI_ActivateMenu Control(Control(CVL(b$)).ParentID), False
|
||||
ELSE
|
||||
__UI_CloseAllMenus
|
||||
END IF
|
||||
|
@ -2564,6 +2588,12 @@ SUB LoadPreview (Destination AS _BYTE)
|
|||
IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$
|
||||
Control(TempValue).BorderSize = CVI(b$)
|
||||
IF LogFileLoad THEN PRINT #LogFileNum, "BORDER SIZE" + STR$(CVI(b$))
|
||||
CASE -44
|
||||
DIM RegisterResult AS _BYTE, Combo AS STRING
|
||||
IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$
|
||||
IF NOT Disk THEN Combo = ReadSequential$(Clip$, CVI(b$)) ELSE Combo = SPACE$(CVI(b$)): GET #BinaryFileNum, , ContextMenuName
|
||||
RegisterResult = RegisterKeyCombo(Combo, TempValue)
|
||||
IF LogFileLoad THEN PRINT #LogFileNum, "KEY COMBO:"; Combo
|
||||
CASE -1 'new control
|
||||
IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL: -1"
|
||||
EXIT DO
|
||||
|
@ -3304,6 +3334,10 @@ SUB SavePreview (Destination AS _BYTE)
|
|||
b$ = MKI$(-43) + MKI$(Control(i).BorderSize)
|
||||
IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$
|
||||
END IF
|
||||
IF Control(i).KeyCombo > 0 THEN
|
||||
b$ = MKI$(-44) + MKI$(LEN(RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo))) + RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo)
|
||||
IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
NEXT
|
||||
|
|
|
@ -79,5 +79,6 @@ FOR EACH CONTROL (FORM INCLUDED):
|
|||
INTEGER -42 (AutoSize = True)
|
||||
For Label controls
|
||||
INTEGER -43 (BorderSize) + INTEGER .BorderSize
|
||||
INTEGER -44 (Key combo) + INTEGER LEN(Key combo) + Key combo
|
||||
-------------------
|
||||
INTEGER -1024 (End of file)
|
Loading…
Reference in a new issue