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

Improved detection of edits to loaded forms. Also:

- Make control IDs more user friendly by encapsulating them in an easily recognizable variable.
- Trigger __UI_TextChanged with backspace and delete as well.
- Indicate in the title bar that a form was edited (*).
- Only show confirmation at exit if form was edited.
- If the preview app is launched by the user, a new messagebox informs that the main app must be launched.
This commit is contained in:
FellippeHeitor 2016-12-07 11:42:10 -02:00
parent c756445186
commit 8a5b943f63
5 changed files with 102 additions and 35 deletions

View file

@ -335,6 +335,7 @@ SUB __UI_Init
IF __UI_FormID = 0 THEN SYSTEM
SCREEN _NEWIMAGE(Control(__UI_FormID).Width, Control(__UI_FormID).Height, 32)
_DELAY .1
_SCREENSHOW
_DELAY .1
@ -375,6 +376,7 @@ SUB __UI_Init
_DISPLAYORDER _SOFTWARE, _HARDWARE
_DISPLAY
__UI_AssignIDs
__UI_OnLoad
__UI_EventsTimer = _FREETIMER
@ -1975,6 +1977,7 @@ SUB __UI_EventDispatcher
NEXT
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Left = LeftMost
END IF
NEXT
@ -1990,6 +1993,7 @@ SUB __UI_EventDispatcher
NEXT
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Left = RightMost - (Control(i).Width - 1)
END IF
NEXT
@ -2012,6 +2016,7 @@ SUB __UI_EventDispatcher
BottomMost = 0
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
IF Control(i).Top < TopMost THEN TopMost = Control(i).Top
IF Control(i).Top + Control(i).Height - 1 > BottomMost THEN BottomMost = Control(i).Top + Control(i).Height - 1
END IF
@ -2025,6 +2030,7 @@ SUB __UI_EventDispatcher
TopDifference = TopMost - NewTopMost
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Top = Control(i).Top - TopDifference
END IF
NEXT
@ -2060,6 +2066,7 @@ SUB __UI_EventDispatcher
LeftDifference = LeftMost - NewLeftMost
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Left = Control(i).Left - LeftDifference
END IF
NEXT
@ -2086,6 +2093,7 @@ SUB __UI_EventDispatcher
END IF
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Top = NewTopMost - Control(i).Height / 2
END IF
NEXT
@ -2112,6 +2120,7 @@ SUB __UI_EventDispatcher
END IF
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Left = NewLeftMost - Control(i).Width / 2
END IF
NEXT
@ -2126,6 +2135,7 @@ SUB __UI_EventDispatcher
NEXT
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Top = TopMost
END IF
NEXT
@ -2140,6 +2150,7 @@ SUB __UI_EventDispatcher
NEXT
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
Control(i).Top = BottomMost - (Control(i).Height - 1)
END IF
NEXT
@ -2180,6 +2191,7 @@ SUB __UI_EventDispatcher
BinSize = TotalSpace \ (__UI_TotalSelectedControls - 1)
FindLefts = Control(SubList(1)).Left - BinSize
FOR i = 1 TO __UI_TotalSelectedControls
__UI_Click 0 'Force the preview to inform it was edited
FindLefts = FindLefts + BinSize
Control(SubList(i)).Left = FindLefts
FindLefts = FindLefts + Control(SubList(i)).Width
@ -2232,6 +2244,7 @@ SUB __UI_EventDispatcher
BinSize = TotalSpace \ (__UI_TotalSelectedControls - 1)
FindTops = Control(SubList(1)).Top - BinSize
FOR i = 1 TO __UI_TotalSelectedControls
__UI_Click 0 'Force the preview to inform it was edited
FindTops = FindTops + BinSize
Control(SubList(i)).Top = FindTops
FindTops = FindTops + Control(SubList(i)).Height
@ -2278,6 +2291,7 @@ SUB __UI_EventDispatcher
'Drag update
DIM SetNewParent AS _BYTE, LeftOffset AS INTEGER, TopOffset AS INTEGER
IF __UI_IsDragging AND __UI_DraggingID > 0 THEN
__UI_Click 0 'Force the preview to inform it was edited
IF Control(__UI_DraggingID).Type <> __UI_Type_Frame THEN
IF Control(__UI_BelowHoveringID).Type = __UI_Type_Frame OR Control(__UI_HoveringID).Type = __UI_Type_Frame THEN
IF Control(__UI_HoveringID).Type = __UI_Type_Frame THEN __UI_BelowHoveringID = __UI_HoveringID
@ -2342,6 +2356,7 @@ SUB __UI_EventDispatcher
END IF
END IF
IF __UI_IsResizing AND __UI_ResizingID > 0 THEN
__UI_Click 0 'Force the preview to inform it was edited
__UI_ForceRedraw = __UI_True
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
@ -2948,6 +2963,7 @@ SUB __UI_EventDispatcher
ELSE
__UI_DeleteSelection
END IF
__UI_TextChanged __UI_Focus
END IF
CASE 13
IF Control(__UI_Focus).Multiline THEN
@ -2960,6 +2976,7 @@ SUB __UI_EventDispatcher
Control(__UI_Focus).Cursor = Control(__UI_Focus).Cursor + 1
END IF
Control(__UI_Focus).CurrentLine = Control(__UI_Focus).CurrentLine + 1
__UI_TextChanged __UI_Focus
ELSE
's1 = Control(__UI_Focus).SelectionStart
's2 = Control(__UI_Focus).Cursor
@ -2979,9 +2996,11 @@ SUB __UI_EventDispatcher
ELSEIF Control(__UI_Focus).Cursor > 0 AND Control(__UI_Focus).Cursor <= LEN(Text(__UI_Focus)) - 1 THEN
Text(__UI_Focus) = LEFT$(Text(__UI_Focus), Control(__UI_Focus).Cursor) + MID$(Text(__UI_Focus), Control(__UI_Focus).Cursor + 2)
END IF
__UI_TextChanged __UI_Focus
END IF
ELSE
__UI_DeleteSelection
__UI_TextChanged __UI_Focus
END IF
CASE 19200 'Left arrow key
__UI_CheckSelection __UI_Focus
@ -3100,6 +3119,7 @@ SUB __UI_EventDispatcher
CASE ASC("V"), ASC("v")
IF __UI_CtrlIsDown THEN
ControlPaste:
__UI_Click 0 'Force the preview to inform it was edited
Clip$ = _CLIPBOARD$
IF Clip$ = "InForm" + CHR$(1) THEN
DIM PasteID AS LONG, ThisControl AS LONG, FirstToBeSelected AS LONG
@ -3163,6 +3183,7 @@ SUB __UI_EventDispatcher
ControlDelete:
FOR i = UBOUND(Control) TO 1 STEP -1
IF Control(i).ControlIsSelected THEN
__UI_Click 0 'Force the preview to inform it was edited
IF Control(i).Type = __UI_Type_Frame THEN
'Remove controls from container before deleting it
FOR j = 1 TO UBOUND(Control)
@ -3194,6 +3215,7 @@ SUB __UI_EventDispatcher
CASE 19200 'Left arrow key
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected AND Control(i).Type <> __UI_Type_MenuBar AND Control(i).Type <> __UI_Type_MenuItem THEN
__UI_Click 0 'Force the preview to inform it was edited
IF __UI_ShiftIsDown THEN
Control(i).Width = Control(i).Width - 1
ELSE
@ -3204,6 +3226,7 @@ SUB __UI_EventDispatcher
CASE 19712 'Right arrow key
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected AND Control(i).Type <> __UI_Type_MenuBar AND Control(i).Type <> __UI_Type_MenuItem THEN
__UI_Click 0 'Force the preview to inform it was edited
IF __UI_ShiftIsDown THEN
Control(i).Width = Control(i).Width + 1
ELSE
@ -3214,6 +3237,7 @@ SUB __UI_EventDispatcher
CASE 18432 'Up arrow key
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected AND Control(i).Type <> __UI_Type_MenuBar AND Control(i).Type <> __UI_Type_MenuItem THEN
__UI_Click 0 'Force the preview to inform it was edited
IF __UI_ShiftIsDown THEN
Control(i).Height = Control(i).Height - 1
ELSE
@ -3224,6 +3248,7 @@ SUB __UI_EventDispatcher
CASE 20480 'Down arrow key
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected AND Control(i).Type <> __UI_Type_MenuBar AND Control(i).Type <> __UI_Type_MenuItem THEN
__UI_Click 0 'Force the preview to inform it was edited
IF __UI_ShiftIsDown THEN
Control(i).Height = Control(i).Height + 1
ELSE

View file

@ -10,7 +10,7 @@ DIM SHARED PreviewFormID AS LONG, ColorPreviewID AS LONG
DIM SHARED BackStyleListID AS LONG, PropertyUpdateStatusID AS LONG
DIM SHARED CheckPreviewTimer AS INTEGER, PreviewAttached AS _BYTE, AutoNameControls AS _BYTE
DIM SHARED PropertyUpdateStatusImage AS LONG, LastKeyPress AS DOUBLE
DIM SHARED UiEditorTitle$
DIM SHARED UiEditorTitle$, Edited AS _BYTE
CONST OffsetEditorPID = 1
CONST OffsetPreviewPID = 5
@ -151,12 +151,14 @@ SUB __UI_Click (id AS LONG)
b$ = MKI$(__UI_Type_MenuBar)
PUT #UiEditorFile, OffsetNewControl, b$
CLOSE #UiEditorFile
Edited = __UI_True
CASE "INSERTMENUMENUITEM"
UiEditorFile = FREEFILE
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
b$ = MKI$(__UI_Type_MenuItem)
PUT #UiEditorFile, OffsetNewControl, b$
CLOSE #UiEditorFile
Edited = __UI_True
CASE "VIEWMENUPREVIEWDETACH"
PreviewAttached = NOT PreviewAttached
Control(id).Value = PreviewAttached
@ -179,6 +181,7 @@ SUB __UI_Click (id AS LONG)
b$ = MKI$(Dummy)
PUT #UiEditorFile, OffsetNewControl, b$
CLOSE #UiEditorFile
Edited = __UI_True
CASE "STRETCH"
b$ = MKI$(Control(id).Value)
SendData b$, 14
@ -458,11 +461,13 @@ SUB __UI_Click (id AS LONG)
CASE "HELPMENUHELP"
Answer = __UI_MessageBox("Design a form and export the resulting code to generate an event-driven QB64 program.", "What's all this?", __UI_MsgBox_OkOnly + __UI_MsgBox_Information)
CASE "FILEMENUEXIT"
Answer = __UI_MessageBox("Save the current form before leaving?", "", __UI_MsgBox_YesNoCancel + __UI_MsgBox_Question)
IF Answer = __UI_MsgBox_Cancel THEN
EXIT SUB
ELSEIF Answer = __UI_MsgBox_Yes THEN
SaveForm __UI_False
IF Edited THEN
Answer = __UI_MessageBox("Save the current form before leaving?", "", __UI_MsgBox_YesNoCancel + __UI_MsgBox_Question)
IF Answer = __UI_MsgBox_Cancel THEN
EXIT SUB
ELSEIF Answer = __UI_MsgBox_Yes THEN
SaveForm __UI_False
END IF
END IF
SYSTEM
END SELECT
@ -526,7 +531,8 @@ SUB __UI_BeforeUpdateDisplay
'Controls in the editor lose focus when the preview is manipulated
b$ = SPACE$(2): GET #UiEditorFile, OffsetNewDataFromPreview, b$
IF CVI(b$) = -1 THEN
IF CVI(b$) = -1 OR CVI(b$) = -3 THEN
IF CVI(b$) = -1 THEN Edited = __UI_True
IF __UI_ActiveMenu = 0 THEN __UI_Focus = 0
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromPreview, b$
ELSEIF CVI(b$) = -2 THEN
@ -555,6 +561,10 @@ SUB __UI_BeforeUpdateDisplay
Caption(__UI_FormID) = UiEditorTitle$ + " - " + RTRIM$(PreviewControls(PreviewFormID).Name) + ".frm"
END IF
IF Edited THEN
IF RIGHT$(Caption(__UI_FormID), 1) <> "*" THEN Caption(__UI_FormID) = Caption(__UI_FormID) + "*"
END IF
SelectedProperty = Control(__UI_GetID("PropertiesList")).Value
IF PreviewHasMenuActive THEN
@ -955,11 +965,13 @@ END SUB
SUB __UI_BeforeUnload
DIM Answer AS _BYTE
Answer = __UI_MessageBox("Save the current form before leaving?", "", __UI_MsgBox_YesNoCancel + __UI_MsgBox_Question)
IF Answer = __UI_MsgBox_Cancel THEN
__UI_UnloadSignal = __UI_False
ELSEIF Answer = __UI_MsgBox_Yes THEN
SaveForm __UI_False
IF Edited THEN
Answer = __UI_MessageBox("Save the current form before leaving?", "", __UI_MsgBox_YesNoCancel + __UI_MsgBox_Question)
IF Answer = __UI_MsgBox_Cancel THEN
__UI_UnloadSignal = __UI_False
ELSEIF Answer = __UI_MsgBox_Yes THEN
SaveForm __UI_False
END IF
END IF
END SUB
@ -1569,6 +1581,7 @@ SUB SendData (b$, Property AS INTEGER)
b$ = MKI$(Property): PUT #FileNum, OffsetPropertyChanged, b$
b$ = MKI$(-1): PUT #FileNum, OffsetNewDataFromEditor, b$
CLOSE #FileNum
Edited = __UI_True
END SUB
SUB UpdateColorPreview (Attribute AS _BYTE, ForeColor AS _UNSIGNED LONG, BackColor AS _UNSIGNED LONG)
@ -1685,8 +1698,9 @@ SUB SaveForm (ExitToQB64 AS _BYTE)
IF _FILEEXISTS(BaseOutputFileName + ".frmbin") THEN KILL BaseOutputFileName + ".frmbin"
BinaryFileNum = FREEFILE
OPEN BaseOutputFileName + ".frmbin" FOR BINARY AS #BinaryFileNum
PRINT #TextFileNum, "'InForm - GUI system for QB64 - Beta version 1"
PRINT #TextFileNum, "'Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor"
PRINT #TextFileNum, "': This form was generated by"
PRINT #TextFileNum, "': InForm - GUI system for QB64 - Beta version 1"
PRINT #TextFileNum, "': Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor"
PRINT #TextFileNum, "'-----------------------------------------------------------"
PRINT #TextFileNum, "SUB __UI_LoadForm"
PRINT #TextFileNum,
@ -1938,17 +1952,34 @@ SUB SaveForm (ExitToQB64 AS _BYTE)
b$ = MKI$(-1024): PUT #BinaryFileNum, , b$ 'end of file
PRINT #TextFileNum, "END SUB"
PRINT #TextFileNum,
PRINT #TextFileNum, "SUB __UI_AssignIDs"
FOR i = 1 TO UBOUND(PreviewControls)
IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel AND PreviewControls(i).Type <> __UI_Type_ContextMenu THEN
PRINT #TextFileNum, " " + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + " = __UI_GetID(" + CHR$(34) + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + CHR$(34) + ")"
END IF
NEXT
PRINT #TextFileNum, "END SUB"
CLOSE #TextFileNum, #BinaryFileNum
OPEN BaseOutputFileName + ".bas" FOR OUTPUT AS #TextFileNum
PRINT #TextFileNum, "'This program was generated by"
PRINT #TextFileNum, "'InForm - GUI system for QB64 - Beta version 1"
PRINT #TextFileNum, "'Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor"
PRINT #TextFileNum, "': This program was generated by"
PRINT #TextFileNum, "': InForm - GUI system for QB64 - Beta version 1"
PRINT #TextFileNum, "': Fellippe Heitor, 2016 - fellippe@qb64.org - @fellippeheitor"
PRINT #TextFileNum, "'-----------------------------------------------------------"
PRINT #TextFileNum,
PRINT #TextFileNum, "': Controls' IDs: ------------------------------------------------------------------"
FOR i = 1 TO UBOUND(PreviewControls)
IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel AND PreviewControls(i).Type <> __UI_Type_ContextMenu THEN
PRINT #TextFileNum, "DIM SHARED " + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + " AS LONG"
END IF
NEXT
PRINT #TextFileNum,
PRINT #TextFileNum, "': External modules: ---------------------------------------------------------------"
PRINT #TextFileNum, "'$INCLUDE:'InForm.ui'"
PRINT #TextFileNum, "'$INCLUDE:'" + BaseOutputFileName + ".frm'"
PRINT #TextFileNum, "'$INCLUDE:'xp.uitheme'"
PRINT #TextFileNum,
PRINT #TextFileNum, "'Event procedures: ---------------------------------------------------------------"
PRINT #TextFileNum, "': Event procedures: ---------------------------------------------------------------"
FOR i = 0 TO 13
SELECT EVERYCASE i
CASE 0: PRINT #TextFileNum, "SUB __UI_BeforeInit"
@ -1970,40 +2001,40 @@ SUB SaveForm (ExitToQB64 AS _BYTE)
PRINT #TextFileNum,
CASE 4 TO 6, 9, 10 'All controls except for Menu panels, and internal context menus
PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(Control(id).Name))"
PRINT #TextFileNum, " SELECT CASE id"
FOR Dummy = 1 TO UBOUND(PreviewControls)
IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).Type <> __UI_Type_Font AND PreviewControls(Dummy).Type <> __UI_Type_ContextMenu THEN
PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34)
PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name)
PRINT #TextFileNum,
END IF
NEXT
PRINT #TextFileNum, " END SELECT"
CASE 7, 8, 11 'Controls that can have focus only
PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(Control(id).Name))"
PRINT #TextFileNum, " SELECT CASE id"
FOR Dummy = 1 TO UBOUND(PreviewControls)
IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).CanHaveFocus THEN
PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34)
PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name)
PRINT #TextFileNum,
END IF
NEXT
PRINT #TextFileNum, " END SELECT"
CASE 12 'Text boxes
PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(Control(id).Name))"
PRINT #TextFileNum, " SELECT CASE id"
FOR Dummy = 1 TO UBOUND(PreviewControls)
IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_TextBox) THEN
PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34)
PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name)
PRINT #TextFileNum,
END IF
NEXT
PRINT #TextFileNum, " END SELECT"
CASE 13 'Dropdown list, List box and Track bar
PRINT #TextFileNum, " SELECT CASE UCASE$(RTRIM$(Control(id).Name))"
PRINT #TextFileNum, " SELECT CASE id"
FOR Dummy = 1 TO UBOUND(PreviewControls)
IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_ListBox OR PreviewControls(Dummy).Type = __UI_Type_DropdownList OR PreviewControls(Dummy).Type = __UI_Type_TrackBar) THEN
PRINT #TextFileNum, " CASE " + CHR$(34) + UCASE$(RTRIM$(PreviewControls(Dummy).Name)) + CHR$(34)
PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name)
PRINT #TextFileNum,
END IF
NEXT

View file

@ -241,6 +241,7 @@ SUB __UI_LoadForm
Control(__UI_NewID).CanHaveFocus = __UI_True
__UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "ColorPreview", 159, 115, 10, 51, __UI_GetID("ColorMixer"))
Control(__UI_NewID).HasBorder = __UI_True
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "Red", 198, 40, 191, 17, __UI_GetID("ColorMixer"))
Control(__UI_NewID).Max = 255
@ -273,3 +274,7 @@ SUB __UI_LoadForm
Control(__UI_NewID).CanHaveFocus = __UI_True
END SUB
SUB __UI_AssignIDs
END SUB

View file

@ -61,7 +61,7 @@ END SUB
SUB __UI_MouseEnter (id AS LONG)
DIM b$
b$ = MKI$(-1)
b$ = MKI$(-3)
SendData b$, OffsetNewDataFromPreview
END SUB
@ -75,21 +75,15 @@ SUB __UI_FocusOut (id AS LONG)
END SUB
SUB __UI_MouseDown (id AS LONG)
DIM b$
b$ = MKI$(-1)
SendData b$, OffsetNewDataFromPreview
END SUB
SUB __UI_MouseUp (id AS LONG)
DIM b$
b$ = MKI$(-1)
SendData b$, OffsetNewDataFromPreview
END SUB
SUB __UI_BeforeUpdateDisplay
DIM NewWindowTop AS INTEGER, NewWindowLeft AS INTEGER
DIM b$, TempValue AS LONG, i AS LONG, j AS LONG, UiEditorPID AS LONG
STATIC MidRead AS _BYTE, UiEditorFile AS INTEGER
STATIC MidRead AS _BYTE, UiEditorFile AS INTEGER, EditorWasActive AS _BYTE
SavePreview
@ -128,8 +122,15 @@ SUB __UI_BeforeUpdateDisplay
b& = GetExitCodeProcess(hnd&, ExitCode&)
IF b& = 1 AND ExitCode& = 259 THEN
'Editor is active.
EditorWasActive = __UI_True
ELSE
'Editor was closed.
IF EditorWasActive = __UI_False THEN
'Preview was launched by user
DIM Answer AS LONG
_SCREENHIDE
Answer = __UI_MessageBox("InForm Designer is not running. Please run the main program.", "InForm Preview", 0)
END IF
SYSTEM
END IF
b& = CloseHandle(hnd&)

View file

@ -7,6 +7,11 @@ SUB __UI_LoadForm
$RESIZE:ON
_RESIZE OFF
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Form1", 640, 400, 0, 0,0)
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Form1", 300, 300, 0, 0,0)
Control(__UI_NewID).Font = __UI_Font("segoeui.ttf", 12, "")
END SUB
SUB __UI_AssignIDs
END SUB