mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 11:59:34 +00:00
Allows adding a new MenuBar control by right-clicking the preview.
This commit is contained in:
parent
ad5f7e4654
commit
c6e6c25aad
2 changed files with 41 additions and 17 deletions
|
@ -1692,6 +1692,7 @@ SUB __UI_EventDispatcher
|
|||
Control(__UI_GetID("__UI_PreviewMenuImageOriginalSize")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuNewMenuBar")).Hidden = False
|
||||
ELSEIF __UI_TotalSelectedControls = 1 THEN
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignLeft")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignRight")).Hidden = True
|
||||
|
@ -1702,7 +1703,9 @@ SUB __UI_EventDispatcher
|
|||
Control(__UI_GetID("__UI_PreviewMenuAlignCenterH")).Hidden = False
|
||||
SetCaption __UI_GetID("__UI_PreviewMenuAlignCenterV"), "Center &Vertically"
|
||||
SetCaption __UI_GetID("__UI_PreviewMenuAlignCenterH"), "Center &Horizontally-"
|
||||
Control(__UI_GetID("__UI_PreviewMenuNewMenuBar")).Hidden = True
|
||||
ELSE
|
||||
Control(__UI_GetID("__UI_PreviewMenuNewMenuBar")).Hidden = False
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignCenterV")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignCenterH")).Hidden = True
|
||||
END IF
|
||||
|
@ -1750,6 +1753,7 @@ SUB __UI_EventDispatcher
|
|||
Control(__UI_GetID("__UI_PreviewMenuCopy")).Disabled = False
|
||||
Control(__UI_GetID("__UI_PreviewMenuDelete")).Disabled = False
|
||||
ELSEIF __UI_TotalSelectedControls = 2 THEN
|
||||
Control(__UI_GetID("__UI_PreviewMenuNewMenuBar")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignLeft")).Hidden = False
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignRight")).Hidden = False
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignTops")).Hidden = False
|
||||
|
@ -1769,6 +1773,7 @@ SUB __UI_EventDispatcher
|
|||
Control(__UI_GetID("__UI_PreviewMenuSetDefaultButton")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuNumericOnly")).Hidden = True
|
||||
ELSE
|
||||
Control(__UI_GetID("__UI_PreviewMenuNewMenuBar")).Hidden = True
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignLeft")).Hidden = False
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignRight")).Hidden = False
|
||||
Control(__UI_GetID("__UI_PreviewMenuAlignTops")).Hidden = False
|
||||
|
@ -2511,6 +2516,8 @@ SUB __UI_EventDispatcher
|
|||
ELSE
|
||||
__UI_DefaultButtonID = __UI_FirstSelectedID
|
||||
END IF
|
||||
CASE UCASE$("__UI_PreviewMenuNewMenuBar")
|
||||
__UI_KeyPress 224
|
||||
CASE "__UI_PREVIEWMENUCUT": GOTO ControlCut
|
||||
CASE "__UI_PREVIEWMENUCOPY": GOTO ControlCopy
|
||||
CASE "__UI_PREVIEWMENUPASTE": GOTO ControlPaste
|
||||
|
|
|
@ -59,6 +59,7 @@ CONST EmptyForm$ = "9iVA_9GK1P<000`ooO7000@00D006mVL]53;1`B000000000noO100006mVL
|
|||
' 221 = Select all controls
|
||||
' 222 = Add new textbox with the .NumericOnly property set to true
|
||||
' 223 = Switch .NumericOnly between True/__UI_NumericWithBounds
|
||||
' 224 = Add new MenuBar control
|
||||
|
||||
'SavePreview parameters:
|
||||
CONST InDisk = 1
|
||||
|
@ -135,6 +136,33 @@ SUB AutoSizeLabel (this AS __UI_ControlTYPE)
|
|||
_FONT tempFont
|
||||
END SUB
|
||||
|
||||
FUNCTION AddNewMenuBarControl&
|
||||
DIM i AS LONG, TempValue AS LONG
|
||||
|
||||
'Before adding a menu bar item, reset all other menu bar items' alignment
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
IF Control(i).Type = __UI_Type_MenuBar THEN
|
||||
Control(i).Align = __UI_Left
|
||||
END IF
|
||||
NEXT
|
||||
TempValue = __UI_NewControl(__UI_Type_MenuBar, "", 0, 0, 0, 0, 0)
|
||||
SetCaption TempValue, RTRIM$(Control(TempValue).Name)
|
||||
__UI_RefreshMenuBar
|
||||
__UI_ActivateMenu Control(TempValue), False
|
||||
AddNewMenuBarControl& = TempValue
|
||||
END FUNCTION
|
||||
|
||||
SUB SelectNewControl (id AS LONG)
|
||||
DIM i AS LONG
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
Control(i).ControlIsSelected = False
|
||||
NEXT
|
||||
Control(id).ControlIsSelected = True
|
||||
__UI_TotalSelectedControls = 1
|
||||
__UI_FirstSelectedID = id
|
||||
__UI_ForceRedraw = True
|
||||
END SUB
|
||||
|
||||
SUB __UI_BeforeUpdateDisplay
|
||||
DIM NewWindowTop AS INTEGER, NewWindowLeft AS INTEGER
|
||||
DIM a$, b$, TempValue AS LONG, i AS LONG, j AS LONG, UiEditorPID AS LONG
|
||||
|
@ -279,16 +307,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
TempValue = __UI_NewControl(TempValue, "", 230, 150, TempWidth \ 2 - 115, TempHeight \ 2 - 75, 0)
|
||||
SetCaption TempValue, RTRIM$(Control(TempValue).Name)
|
||||
CASE __UI_Type_MenuBar
|
||||
'Before adding a menu bar item, reset all other menu bar items' alignment
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
IF Control(i).Type = __UI_Type_MenuBar THEN
|
||||
Control(i).Align = __UI_Left
|
||||
END IF
|
||||
NEXT
|
||||
TempValue = __UI_NewControl(TempValue, "", 0, 0, 0, 0, 0)
|
||||
SetCaption TempValue, RTRIM$(Control(TempValue).Name)
|
||||
__UI_RefreshMenuBar
|
||||
__UI_ActivateMenu Control(TempValue), False
|
||||
TempValue = AddNewMenuBarControl
|
||||
CASE __UI_Type_MenuItem
|
||||
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) <> "__UI_" THEN
|
||||
TempValue = __UI_NewControl(TempValue, "", 0, 0, 0, 0, __UI_ParentMenu)
|
||||
|
@ -301,13 +320,7 @@ SUB __UI_BeforeUpdateDisplay
|
|||
IF __UI_ActiveMenu > 0 AND (Control(TempValue).Type <> __UI_Type_MenuBar AND Control(TempValue).Type <> __UI_Type_MenuItem) THEN
|
||||
__UI_DestroyControl Control(__UI_ActiveMenu)
|
||||
END IF
|
||||
FOR i = 1 TO UBOUND(Control)
|
||||
Control(i).ControlIsSelected = False
|
||||
NEXT
|
||||
Control(TempValue).ControlIsSelected = True
|
||||
__UI_TotalSelectedControls = 1
|
||||
__UI_FirstSelectedID = TempValue
|
||||
__UI_ForceRedraw = True
|
||||
SelectNewControl TempValue
|
||||
END IF
|
||||
|
||||
IF __UI_FirstSelectedID > 0 THEN
|
||||
|
@ -1034,6 +1047,10 @@ SUB __UI_KeyPress (id AS LONG)
|
|||
SelectAllControls
|
||||
CASE 223
|
||||
AlternateNumericOnlyProperty
|
||||
CASE 224
|
||||
DIM TempID AS LONG
|
||||
TempID = AddNewMenuBarControl
|
||||
SelectNewControl TempID
|
||||
END SELECT
|
||||
END SUB
|
||||
|
||||
|
|
Loading…
Reference in a new issue