1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

Improved detection of changes by form resizing.

This commit is contained in:
FellippeHeitor 2018-03-17 00:08:12 -03:00
parent 417ab5edf2
commit a174f67334
2 changed files with 24 additions and 6 deletions

View file

@ -600,6 +600,12 @@ SUB __UI_BeforeUpdateDisplay
ELSEIF CVI(b$) = -6 THEN
'User attempted to load an invalid icon file
Answer = MessageBox("Only .ico files are accepted.", "", MsgBox_OkOnly + MsgBox_Exclamation)
ELSEIF CVI(b$) = -7 THEN
'A new empty form has just been created or a file has just finished loading from disk
Edited = False: echo "reset Edited with signal -7"
ELSEIF CVI(b$) = -8 THEN
'Preview form was resized
Edited = True: echo "-8 PreviewForm was resized
END IF
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$

View file

@ -23,6 +23,7 @@ DIM SHARED UiPreviewPID AS LONG
DIM SHARED ExeIcon AS LONG
DIM SHARED AutoNameControls AS _BYTE
DIM SHARED UndoPointer AS INTEGER, TotalUndoImages AS INTEGER, MidUndo AS _BYTE
DIM SHARED IsCreating AS _BYTE
REDIM SHARED QB64KEYWORDS(0) AS STRING
READ_KEYWORDS
@ -64,15 +65,11 @@ $END IF
'Event procedures: ---------------------------------------------------------------
SUB __UI_Click (id AS LONG)
DIM b$
b$ = MKI$(-1)
SendData b$, OffsetNewDataFromPreview
SendSignal -1
END SUB
SUB __UI_MouseEnter (id AS LONG)
DIM b$
b$ = MKI$(-3)
SendData b$, OffsetNewDataFromPreview
SendSignal -3
END SUB
SUB __UI_MouseLeave (id AS LONG)
@ -265,6 +262,7 @@ SUB __UI_BeforeUpdateDisplay
_SCREENSHOW
ELSEIF TempValue = -4 THEN
'Load an existing file
IsCreating = True
b$ = SPACE$(2): GET #UiEditorFile, OffsetPropertyValue, b$
b$ = SPACE$(CVI(b$)): GET #UiEditorFile, , b$
DIM FileToLoad AS INTEGER
@ -287,8 +285,10 @@ SUB __UI_BeforeUpdateDisplay
END IF
UndoPointer = 0
TotalUndoImages = 0
SendSignal -7 'Form just loaded
ELSEIF TempValue = -5 THEN
'Reset request (new form)
IsCreating = True
a$ = Unpack$(EmptyForm$)
FileToLoad = FREEFILE
@ -299,6 +299,7 @@ SUB __UI_BeforeUpdateDisplay
LoadPreview
UndoPointer = 0
TotalUndoImages = 0
SendSignal -7 'New form created
ELSEIF TempValue = -1 THEN
DIM FloatValue AS _FLOAT
'Editor sent property value
@ -838,7 +839,18 @@ SUB __UI_BeforeInit
END SUB
SUB __UI_FormResized
STATIC TimesResized AS INTEGER
IF IsCreating THEN TimesResized = 0
TimesResized = TimesResized + 1
IF TimesResized > 5 THEN
'Manually resizing a form triggers this event a few times;
'Loading a form triggers it 2 or three times usually.
TimesResized = 0
SendSignal -8
END IF
END SUB
SUB __UI_OnLoad