1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 03:49:56 +00:00

Tweaks Editor and Preview to interact more like a single app.

Menus close in one if another menu is opened in the other, for instance. Also: controls in the editor properly lose focus when preview is manipulated.
This commit is contained in:
FellippeHeitor 2018-06-12 23:40:33 -03:00
parent 0dd47761ed
commit db04859087
2 changed files with 20 additions and 13 deletions

View file

@ -277,6 +277,8 @@ SUB __UI_Click (id AS LONG)
DIM Answer AS _BYTE, Dummy AS LONG, b$
STATIC LastClick#, LastClickedID AS LONG
SendSignal -8
SELECT EVERYCASE id
CASE AlignMenuAlignLeft: Dummy = 201
CASE AlignMenuAlignRight: Dummy = 202
@ -843,6 +845,13 @@ SUB SelectFontInList (FontSetup$)
BypassShowFontList = True
END SUB
SUB LoseFocus
IF __UI_ActiveMenu > 0 THEN __UI_DestroyControl Control(__UI_ActiveMenu)
IF __UI_ActiveDropdownList > 0 THEN __UI_DestroyControl Control(__UI_ActiveDropdownList)
__UI_Focus = 0
__UI_ForceRedraw = True
END SUB
SUB __UI_BeforeUpdateDisplay
DIM b$, c$
DIM i AS LONG, j AS LONG, Answer AS _BYTE
@ -1020,6 +1029,7 @@ SUB __UI_BeforeUpdateDisplay
PreviewFormID = CVL(thisData$)
CASE "FIRSTSELECTED"
FirstSelected = CVL(thisData$)
LoseFocus
CASE "DEFAULTBUTTONID"
PreviewDefaultButtonID = CVL(thisData$)
CASE "ORIGINALIMAGEWIDTH"
@ -1028,6 +1038,7 @@ SUB __UI_BeforeUpdateDisplay
OriginalImageHeight = CVI(thisData$)
CASE "SELECTIONRECTANGLE"
PreviewSelectionRectangle = CVI(thisData$)
LoseFocus
CASE "MENUPANELACTIVE"
PreviewHasMenuActive = CVI(thisData$)
CASE "SIGNAL"
@ -1038,7 +1049,8 @@ SUB __UI_BeforeUpdateDisplay
IF NOT FormDataReceived THEN
FormDataReceived = True
ELSE
Signal$ = Signal$ + MKI$(-1)
Edited = True
LoseFocus
END IF
CASE "UNDOPOINTER"
UndoPointer = CVI(thisData$)
@ -1060,18 +1072,10 @@ SUB __UI_BeforeUpdateDisplay
END IF
DO WHILE LEN(Signal$)
'signals -1 and -3 deprecated for now
b$ = LEFT$(Signal$, 2)
Signal$ = MID$(Signal$, 3)
IF CVI(b$) = -1 OR CVI(b$) = -3 THEN
'Controls in the editor lose focus when the preview is manipulated
IF CVI(b$) = -1 THEN Edited = True
IF __UI_ActiveDropdownList > 0 THEN __UI_DestroyControl Control(__UI_ActiveDropdownList)
IF CVI(b$) = -1 THEN
IF __UI_ActiveMenu > 0 THEN __UI_DestroyControl Control(__UI_ActiveMenu)
END IF
IF CVI(b$) = -3 THEN __UI_Focus = 0
__UI_ForceRedraw = True
ELSEIF CVI(b$) = -2 THEN
IF CVI(b$) = -2 THEN
'User attempted to right-click a control but the preview
'form is smaller than the menu panel. In such case the "Align"
'menu is shown in the editor.

View file

@ -104,11 +104,9 @@ $END IF
'Event procedures: ---------------------------------------------------------------
SUB __UI_Click (id AS LONG)
SendSignal -3
END SUB
SUB __UI_MouseEnter (id AS LONG)
SendSignal -3
END SUB
SUB __UI_MouseLeave (id AS LONG)
@ -452,6 +450,11 @@ SUB __UI_BeforeUpdateDisplay
END IF
ELSEIF TempValue = -7 THEN
__UI_RestoreImageOriginalSize
ELSEIF TempValue = -8 THEN
'Editor is manipulated, preview menus must be closed.
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) = "__UI_" THEN
__UI_DestroyControl Control(__UI_ActiveMenu)
END IF
ELSEIF TempValue = 214 THEN
RestoreUndoImage
ELSEIF TempValue = 215 THEN