mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-14 11:39:33 +00:00
Add several InFrom example apps
This commit is contained in:
parent
a4166a9091
commit
4052343623
39 changed files with 64537 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.7 Then
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
|
|
11
README.md
11
README.md
|
@ -57,6 +57,15 @@ Assuming your setup is like the above, do the following:
|
|||
- *BeforeUnload*, triggered when the user tries to close the program, either via clicking the window's X button, right click in the task bar -> Close or with Alt+F4 (Windows only).
|
||||
- *FormResized*, triggered when a form with the CanResize property is resized at runtime.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
- Calculator by Terry Ritchie
|
||||
- Fireworks by Fellippe Heitor
|
||||
- TicTacToe by Fellippe Heitor
|
||||
- TicTacToe2 by Fellippe Heitor
|
||||
- Stopwatch by Fellippe Heitor
|
||||
- WordClock by Fellippe Heitor
|
||||
|
||||
## NOTES
|
||||
|
||||
- This requires the latest version of [QB64-PE](https://github.com/QB64-Phoenix-Edition/QB64pe/releases). More accurately, it only works with development version of QB64-PE or with v3.7.1 or v3.8.0 (whenever those are released)
|
||||
- This requires the latest version of [QB64-PE](https://github.com/QB64-Phoenix-Edition/QB64pe/releases). More accurately, it only works with QB64-PE v3.8.0 or above.
|
||||
|
|
1035
examples/Calculator/Calculator.bas
Normal file
1035
examples/Calculator/Calculator.bas
Normal file
File diff suppressed because it is too large
Load diff
293
examples/Calculator/Calculator.frm
Normal file
293
examples/Calculator/Calculator.frm
Normal file
|
@ -0,0 +1,293 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - v1.5
|
||||
': Fellippe Heitor, 2016-2023 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Calculator", 235, 265, 0, 0, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Calculator"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 12)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "frmResults", 220, 51, 8, 36, 0)
|
||||
__UI_RegisterResult = 0
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).Value = 3
|
||||
Control(__UI_NewID).BorderSize = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "mnuEdit", 36, 23, 8, 0, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "&Edit"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "mnuHelp", 41, 23, 44, 0, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Help"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butMC", 40, 23, 8, 92, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "MC"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butMR", 40, 23, 53, 92, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "MR"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butMS", 40, 23, 98, 92, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "MS"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butMplus", 40, 23, 143, 92, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "M+"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butMminus", 40, 23, 188, 92, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "M-"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butBS", 40, 23, 8, 120, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "BS"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butCE", 40, 23, 53, 120, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "CE"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butC", 40, 23, 98, 120, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "C"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butSign", 40, 23, 143, 120, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "+/-"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butSQR", 40, 23, 188, 120, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "SQR"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but7", 40, 23, 8, 148, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "7"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but8", 40, 23, 53, 148, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "8"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but9", 40, 23, 98, 148, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "9"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butDivide", 40, 23, 143, 148, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "/"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butPercent", 40, 23, 188, 148, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "%"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but4", 40, 23, 8, 176, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "4"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but5", 40, 23, 53, 176, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "5"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but6", 40, 23, 98, 176, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "6"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butMultiply", 40, 23, 143, 176, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "*"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butReciprocate", 40, 23, 188, 176, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "1/x"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but1", 40, 23, 8, 204, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "1"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but2", 40, 23, 53, 204, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "2"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but3", 40, 23, 98, 204, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "3"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butSubtract", 40, 23, 143, 204, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "-"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "but0", 85, 23, 8, 232, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "0"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butPoint", 40, 23, 98, 232, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "."
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butAdd", 40, 23, 143, 232, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "+"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "butEqual", 40, 51, 188, 204, 0)
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "="
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "mnuCopy", 124, 21, 0, 4, __UI_GetID("mnuEdit"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Copy CTRL+C"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "mnuPaste", 123, 21, 0, 25, __UI_GetID("mnuEdit"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "Paste CTRL+V"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "mnuAbout", 134, 21, 0, 4, __UI_GetID("mnuHelp"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "About Calculator"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "lblAnswer", 195, 33, 22, 15, __UI_GetID("frmResults"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "123456789012345"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 21)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Align = __UI_Right
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "lblMemory", 13, 24, 6, 27, __UI_GetID("frmResults"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "M"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 14)
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "lblHistory", 212, 21, 4, 4, __UI_GetID("frmResults"))
|
||||
__UI_RegisterResult = 0
|
||||
SetCaption __UI_NewID, "89 + 89 + 32"
|
||||
Control(__UI_NewID).HasBorder = False
|
||||
Control(__UI_NewID).Align = __UI_Right
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
Calculator = __UI_GetID("Calculator")
|
||||
frmResults = __UI_GetID("frmResults")
|
||||
mnuEdit = __UI_GetID("mnuEdit")
|
||||
mnuHelp = __UI_GetID("mnuHelp")
|
||||
butMC = __UI_GetID("butMC")
|
||||
butMR = __UI_GetID("butMR")
|
||||
butMS = __UI_GetID("butMS")
|
||||
butMplus = __UI_GetID("butMplus")
|
||||
butMminus = __UI_GetID("butMminus")
|
||||
butBS = __UI_GetID("butBS")
|
||||
butCE = __UI_GetID("butCE")
|
||||
butC = __UI_GetID("butC")
|
||||
butSign = __UI_GetID("butSign")
|
||||
butSQR = __UI_GetID("butSQR")
|
||||
but7 = __UI_GetID("but7")
|
||||
but8 = __UI_GetID("but8")
|
||||
but9 = __UI_GetID("but9")
|
||||
butDivide = __UI_GetID("butDivide")
|
||||
butPercent = __UI_GetID("butPercent")
|
||||
but4 = __UI_GetID("but4")
|
||||
but5 = __UI_GetID("but5")
|
||||
but6 = __UI_GetID("but6")
|
||||
butMultiply = __UI_GetID("butMultiply")
|
||||
butReciprocate = __UI_GetID("butReciprocate")
|
||||
but1 = __UI_GetID("but1")
|
||||
but2 = __UI_GetID("but2")
|
||||
but3 = __UI_GetID("but3")
|
||||
butSubtract = __UI_GetID("butSubtract")
|
||||
but0 = __UI_GetID("but0")
|
||||
butPoint = __UI_GetID("butPoint")
|
||||
butAdd = __UI_GetID("butAdd")
|
||||
butEqual = __UI_GetID("butEqual")
|
||||
mnuCopy = __UI_GetID("mnuCopy")
|
||||
mnuPaste = __UI_GetID("mnuPaste")
|
||||
mnuAbout = __UI_GetID("mnuAbout")
|
||||
lblAnswer = __UI_GetID("lblAnswer")
|
||||
lblMemory = __UI_GetID("lblMemory")
|
||||
lblHistory = __UI_GetID("lblHistory")
|
||||
END SUB
|
344
examples/Calculator/InForm/InForm.bi
Normal file
344
examples/Calculator/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(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
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 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
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER
|
||||
DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG
|
||||
DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/Calculator/InForm/InForm.ui
Normal file
8697
examples/Calculator/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/Calculator/InForm/InFormVersion.bas
Normal file
7
examples/Calculator/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/Calculator/InForm/xp.uitheme
Normal file
1144
examples/Calculator/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
422
examples/Fireworks2Inform/Fireworks.bas
Normal file
422
examples/Fireworks2Inform/Fireworks.bas
Normal file
|
@ -0,0 +1,422 @@
|
|||
': This program uses
|
||||
': InForm - GUI library for QB64 - v1.0
|
||||
': Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
|
||||
'Improved fireworks:
|
||||
' - Particles now leave a trail behind
|
||||
' - Round explosions (sin/cos been used...)
|
||||
' - Explosion sound effect.
|
||||
|
||||
Option _Explicit
|
||||
|
||||
Type Vector
|
||||
x As Single
|
||||
y As Single
|
||||
End Type
|
||||
|
||||
Type Particle
|
||||
Pos As Vector
|
||||
Vel As Vector
|
||||
Acc As Vector
|
||||
Visible As _Byte
|
||||
Exploded As _Byte
|
||||
ExplosionStep As _Byte
|
||||
ExplosionMax As _Byte
|
||||
Color As _Unsigned Long
|
||||
Size As _Byte
|
||||
End Type
|
||||
|
||||
ReDim Shared Firework(1 To 1) As Particle
|
||||
ReDim Shared Boom(1 To UBound(Firework) * 2, 1) As Particle
|
||||
Dim Shared Trail(1 To 20000) As Particle
|
||||
|
||||
Dim Shared StartPointLimit As Single, InitialVel As Single
|
||||
Dim Shared Gravity As Vector, Pause As _Byte, distant As Long
|
||||
|
||||
InitialVel = -30
|
||||
Gravity.y = .8
|
||||
distant = _SndOpen("distant.wav")
|
||||
|
||||
Randomize Timer
|
||||
|
||||
': Controls' IDs: ------------------------------------------------------------------
|
||||
Dim Shared Fireworks As Long
|
||||
Dim Shared Canvas As Long
|
||||
Dim Shared MaxFireworksLB As Long
|
||||
Dim Shared MaxFireworksTrackBar As Long
|
||||
Dim Shared MaxParticlesLB As Long
|
||||
Dim Shared MaxParticlesTrackBar As Long
|
||||
Dim Shared ShowTextCB As Long
|
||||
Dim Shared YourTextHereTB As Long
|
||||
Dim Shared HappyNewYearLB As Long
|
||||
|
||||
': External modules: ---------------------------------------------------------------
|
||||
'$INCLUDE:'InForm\InForm.bi'
|
||||
'$INCLUDE:'InForm\xp.uitheme'
|
||||
'$INCLUDE:'Fireworks.frm'
|
||||
|
||||
': Event procedures: ---------------------------------------------------------------
|
||||
Sub __UI_BeforeInit
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_OnLoad
|
||||
_Title "Baby, you're a firework"
|
||||
StartPointLimit = Control(Canvas).Height / 3
|
||||
Control(MaxFireworksTrackBar).Value = 20
|
||||
Control(MaxParticlesTrackBar).Value = 150
|
||||
ToolTip(MaxFireworksTrackBar) = "20"
|
||||
ToolTip(MaxParticlesTrackBar) = "150"
|
||||
ReDim _Preserve Firework(1 To Control(MaxFireworksTrackBar).Value) As Particle
|
||||
ReDim _Preserve Boom(1 To UBound(Firework) * 2, Control(MaxParticlesTrackBar).Value) As Particle
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUpdateDisplay
|
||||
Static JustExploded As _Byte
|
||||
Static t As Integer, Initial As _Byte, InitialX As Integer, lastInitial#
|
||||
|
||||
Dim As Long j, i, a
|
||||
Dim As _Unsigned Long thisColor
|
||||
|
||||
_Dest Control(Canvas).HelperCanvas
|
||||
|
||||
If JustExploded Then
|
||||
JustExploded = False
|
||||
Cls , _RGB32(0, 0, 50)
|
||||
Else
|
||||
Cls
|
||||
End If
|
||||
If _Ceil(Rnd * 20) < 2 Or (Initial = False And Timer - lastInitial# > .1) Then
|
||||
'Create a new particle
|
||||
For j = 1 To UBound(Firework)
|
||||
If Firework(j).Visible = False Then
|
||||
Firework(j).Vel.y = InitialVel
|
||||
Firework(j).Vel.x = 3 - _Ceil(Rnd * 6)
|
||||
If Initial = True Then
|
||||
Firework(j).Pos.x = _Ceil(Rnd * Control(Canvas).Width)
|
||||
Else
|
||||
Firework(j).Pos.x = InitialX * (Control(Canvas).Width / 15)
|
||||
InitialX = InitialX + 1
|
||||
lastInitial# = Timer
|
||||
If InitialX > 15 Then Initial = True
|
||||
End If
|
||||
Firework(j).Pos.y = Control(Canvas).Height + _Ceil(Rnd * StartPointLimit)
|
||||
Firework(j).Visible = True
|
||||
Firework(j).Exploded = False
|
||||
Firework(j).ExplosionStep = 0
|
||||
Firework(j).Size = _Ceil(Rnd * 2)
|
||||
If Firework(j).Size = 1 Then
|
||||
Firework(j).ExplosionMax = 9 + _Ceil(Rnd * 41)
|
||||
Else
|
||||
Firework(j).ExplosionMax = 9 + _Ceil(Rnd * 71)
|
||||
End If
|
||||
Firework(j).ExplosionMax = 20 '0
|
||||
Exit For
|
||||
End If
|
||||
Next j
|
||||
End If
|
||||
|
||||
'Show trail
|
||||
For i = 1 To UBound(Trail)
|
||||
If Not Pause Then Trail(i).Color = Darken(Trail(i).Color, 70)
|
||||
If Trail(i).Size = 1 Then
|
||||
PSet (Trail(i).Pos.x, Trail(i).Pos.y), Trail(i).Color
|
||||
Else
|
||||
PSet (Trail(i).Pos.x, Trail(i).Pos.y), Trail(i).Color
|
||||
PSet (Trail(i).Pos.x - 1, Trail(i).Pos.y), Trail(i).Color
|
||||
PSet (Trail(i).Pos.x + 1, Trail(i).Pos.y), Trail(i).Color
|
||||
PSet (Trail(i).Pos.x, Trail(i).Pos.y - 1), Trail(i).Color
|
||||
PSet (Trail(i).Pos.x, Trail(i).Pos.y + 1), Trail(i).Color
|
||||
End If
|
||||
Next i
|
||||
|
||||
'Update and show particles
|
||||
For i = 1 To UBound(Firework)
|
||||
'Update trail particles
|
||||
|
||||
If Firework(i).Visible = True And Firework(i).Exploded = False And Not Pause Then
|
||||
t = t + 1: If t > UBound(Trail) Then t = 1
|
||||
Trail(t).Pos.x = Firework(i).Pos.x
|
||||
Trail(t).Pos.y = Firework(i).Pos.y
|
||||
Trail(t).Color = _RGB32(255, 255, 255)
|
||||
|
||||
'New position
|
||||
Firework(i).Vel.y = Firework(i).Vel.y + Gravity.y
|
||||
Firework(i).Pos.y = Firework(i).Pos.y + Firework(i).Vel.y
|
||||
Firework(i).Pos.x = Firework(i).Pos.x + Firework(i).Vel.x
|
||||
End If
|
||||
|
||||
'Explode the particle if it reaches max height
|
||||
If Firework(i).Vel.y > 0 Then
|
||||
If Firework(i).Exploded = False Then
|
||||
Firework(i).Exploded = True
|
||||
JustExploded = True
|
||||
|
||||
If Firework(1).Size = 1 Then
|
||||
If distant Then _SndPlayCopy distant, .5
|
||||
Else
|
||||
If distant Then _SndPlayCopy distant, 1
|
||||
End If
|
||||
|
||||
thisColor~& = _RGB32(_Ceil(Rnd * 255), _Ceil(Rnd * 255), _Ceil(Rnd * 255))
|
||||
a = 0
|
||||
For j = 1 To UBound(Boom, 2)
|
||||
Boom(i, j).Pos.x = Firework(i).Pos.x
|
||||
Boom(i, j).Pos.y = Firework(i).Pos.y
|
||||
Boom(i, j).Vel.y = Sin(a) * (Rnd * 10)
|
||||
Boom(i, j).Vel.x = Cos(a) * (Rnd * 10)
|
||||
a = a + 1
|
||||
Boom(i, j).Color = thisColor~&
|
||||
|
||||
Boom(i * 2, j).Pos.x = Firework(i).Pos.x + 5
|
||||
Boom(i * 2, j).Pos.y = Firework(i).Pos.y + 5
|
||||
Boom(i * 2, j).Vel.y = Boom(i, j).Vel.y
|
||||
Boom(i * 2, j).Vel.x = Boom(i, j).Vel.x
|
||||
a = a + 1
|
||||
Boom(i * 2, j).Color = thisColor~&
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
'Show particle
|
||||
If Firework(i).Exploded = False Then
|
||||
If Firework(i).Size = 1 Then
|
||||
PSet (Firework(i).Pos.x, Firework(i).Pos.y), _RGB32(255, 255, 255)
|
||||
Else
|
||||
PSet (Firework(i).Pos.x, Firework(i).Pos.y), _RGB32(255, 255, 255)
|
||||
PSet (Firework(i).Pos.x - 1, Firework(i).Pos.y), _RGB32(255, 255, 255)
|
||||
PSet (Firework(i).Pos.x + 1, Firework(i).Pos.y), _RGB32(255, 255, 255)
|
||||
PSet (Firework(i).Pos.x, Firework(i).Pos.y - 1), _RGB32(255, 255, 255)
|
||||
PSet (Firework(i).Pos.x, Firework(i).Pos.y + 1), _RGB32(255, 255, 255)
|
||||
End If
|
||||
ElseIf Firework(i).Visible Then
|
||||
If Not Pause Then Firework(i).ExplosionStep = Firework(i).ExplosionStep + 1
|
||||
For j = 1 To UBound(Boom, 2)
|
||||
If Firework(i).Size = 1 Then
|
||||
PSet (Boom(i, j).Pos.x, Boom(i, j).Pos.y), Boom(i, j).Color
|
||||
Else
|
||||
PSet (Boom(i, j).Pos.x, Boom(i, j).Pos.y), Darken(Boom(i, j).Color, 100 - (Firework(i).ExplosionStep * 100) / Firework(i).ExplosionMax)
|
||||
PSet (Boom(i, j).Pos.x - 1, Boom(i, j).Pos.y), Darken(Boom(i, j).Color, 100 - (Firework(i).ExplosionStep * 100) / Firework(i).ExplosionMax)
|
||||
PSet (Boom(i, j).Pos.x + 1, Boom(i, j).Pos.y), Darken(Boom(i, j).Color, 100 - (Firework(i).ExplosionStep * 100) / Firework(i).ExplosionMax)
|
||||
PSet (Boom(i, j).Pos.x, Boom(i, j).Pos.y - 1), Darken(Boom(i, j).Color, 100 - (Firework(i).ExplosionStep * 100) / Firework(i).ExplosionMax)
|
||||
PSet (Boom(i, j).Pos.x, Boom(i, j).Pos.y + 1), Darken(Boom(i, j).Color, 100 - (Firework(i).ExplosionStep * 100) / Firework(i).ExplosionMax)
|
||||
End If
|
||||
If Not Pause Then
|
||||
t = t + 1: If t > UBound(Trail) Then t = 1
|
||||
Trail(t).Pos.x = Boom(i, j).Pos.x
|
||||
Trail(t).Pos.y = Boom(i, j).Pos.y
|
||||
Trail(t).Size = Boom(i, j).Size
|
||||
Trail(t).Color = Darken(Boom(i, j).Color, 100 - (Firework(i).ExplosionStep * 100) / Firework(i).ExplosionMax)
|
||||
|
||||
t = t + 1: If t > UBound(Trail) Then t = 1
|
||||
Trail(t).Pos.x = Boom(i * 2, j).Pos.x
|
||||
Trail(t).Pos.y = Boom(i * 2, j).Pos.y
|
||||
Trail(t).Size = Boom(i * 2, j).Size
|
||||
Trail(t).Color = Darken(Boom(i * 2, j).Color, 150)
|
||||
|
||||
Boom(i, j).Vel.y = Boom(i, j).Vel.y + Gravity.y / 10
|
||||
Boom(i, j).Pos.x = Boom(i, j).Pos.x + Boom(i, j).Vel.x '+ Firework(i).Vel.x
|
||||
Boom(i, j).Pos.y = Boom(i, j).Pos.y + Boom(i, j).Vel.y
|
||||
Boom(i * 2, j).Vel.y = Boom(i * 2, j).Vel.y + Gravity.y / 10
|
||||
Boom(i * 2, j).Pos.x = Boom(i * 2, j).Pos.x + Boom(i * 2, j).Vel.x '+ Firework(i).Vel.x
|
||||
Boom(i * 2, j).Pos.y = Boom(i * 2, j).Pos.y + Boom(i * 2, j).Vel.y
|
||||
End If
|
||||
Next
|
||||
If Firework(i).ExplosionStep > Firework(i).ExplosionMax Then Firework(i).Visible = False
|
||||
End If
|
||||
Next
|
||||
|
||||
Control(HappyNewYearLB).Hidden = Not Control(ShowTextCB).Value
|
||||
|
||||
_Dest 0
|
||||
Control(Canvas).PreviousValue = 0
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUnload
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_Click (id As Long)
|
||||
Select Case id
|
||||
Case Fireworks
|
||||
|
||||
Case Canvas
|
||||
Pause = Not Pause
|
||||
If Pause Then
|
||||
Caption(HappyNewYearLB) = "PAUSED"
|
||||
Else
|
||||
Caption(HappyNewYearLB) = Text(YourTextHereTB)
|
||||
End If
|
||||
Case MaxFireworksLB
|
||||
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesLB
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
Case HappyNewYearLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseEnter (id As Long)
|
||||
Select Case id
|
||||
Case Fireworks
|
||||
|
||||
Case Canvas
|
||||
|
||||
Case MaxFireworksLB
|
||||
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesLB
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
Case HappyNewYearLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseLeave (id As Long)
|
||||
Select Case id
|
||||
Case Fireworks
|
||||
|
||||
Case Canvas
|
||||
|
||||
Case MaxFireworksLB
|
||||
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesLB
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
Case HappyNewYearLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusIn (id As Long)
|
||||
Select Case id
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusOut (id As Long)
|
||||
Select Case id
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseDown (id As Long)
|
||||
Select Case id
|
||||
Case Fireworks
|
||||
|
||||
Case Canvas
|
||||
|
||||
Case MaxFireworksLB
|
||||
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesLB
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
Case HappyNewYearLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseUp (id As Long)
|
||||
Select Case id
|
||||
Case Fireworks
|
||||
|
||||
Case Canvas
|
||||
|
||||
Case MaxFireworksLB
|
||||
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesLB
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
Case HappyNewYearLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_KeyPress (id As Long)
|
||||
Select Case id
|
||||
Case MaxFireworksTrackBar
|
||||
|
||||
Case MaxParticlesTrackBar
|
||||
|
||||
Case ShowTextCB
|
||||
|
||||
Case YourTextHereTB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_TextChanged (id As Long)
|
||||
Select Case id
|
||||
Case YourTextHereTB
|
||||
Caption(HappyNewYearLB) = Text(YourTextHereTB)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_ValueChanged (id As Long)
|
||||
Control(id).Value = Int(Control(id).Value)
|
||||
Select Case id
|
||||
Case MaxFireworksTrackBar
|
||||
ReDim _Preserve Firework(1 To Control(MaxFireworksTrackBar).Value) As Particle
|
||||
ToolTip(id) = Str$(Control(MaxFireworksTrackBar).Value)
|
||||
Case MaxParticlesTrackBar
|
||||
ReDim _Preserve Boom(1 To UBound(Firework) * 2, Control(MaxParticlesTrackBar).Value) As Particle
|
||||
ToolTip(id) = Str$(Control(MaxParticlesTrackBar).Value)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FormResized
|
||||
End Sub
|
||||
|
||||
'$INCLUDE:'InForm\InForm.ui'
|
71
examples/Fireworks2Inform/Fireworks.frm
Normal file
71
examples/Fireworks2Inform/Fireworks.frm
Normal file
|
@ -0,0 +1,71 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - Beta version 8
|
||||
': Fellippe Heitor, 2016-2018 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Fireworks", 810, 663, 0, 0, 0)
|
||||
Caption(__UI_NewID) = "Baby, you're a firework"
|
||||
Control(__UI_NewID).Font = SetFont("arial.ttf?InForm/resources/NotoMono-Regular.ttf", 12)
|
||||
Control(__UI_NewID).CenteredWindow = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "Canvas", 800, 600, 5, 5, 0)
|
||||
SetCaption __UI_NewID, "Your text here"
|
||||
Control(__UI_NewID).Stretch = True
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "MaxFireworksLB", 86, 23, 5, 612, 0)
|
||||
SetCaption __UI_NewID, "Max fireworks:"
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "MaxFireworksTrackBar", 120, 40, 95, 612, 0)
|
||||
Control(__UI_NewID).Min = 1
|
||||
Control(__UI_NewID).Max = 20
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 1
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "MaxParticlesLB", 86, 23, 235, 612, 0)
|
||||
SetCaption __UI_NewID, "Max particles:"
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "MaxParticlesTrackBar", 250, 40, 325, 612, 0)
|
||||
Control(__UI_NewID).Min = 1
|
||||
Control(__UI_NewID).Max = 150
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Interval = 30
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "ShowTextCB", 87, 23, 590, 620, 0)
|
||||
SetCaption __UI_NewID, "Show text:"
|
||||
Control(__UI_NewID).Value = -1
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "YourTextHereTB", 129, 23, 676, 620, 0)
|
||||
SetCaption __UI_NewID, "Your text here"
|
||||
Text(__UI_NewID) = "Happy New Year!"
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "HappyNewYearLB", 800, 78, 5, 527, 0)
|
||||
SetCaption __UI_NewID, "Happy New Year!"
|
||||
Control(__UI_NewID).Font = SetFont("cyberbit.ttf?times.ttf?arial.ttf?InForm/resources/NotoMono-Regular.ttf", 48)
|
||||
Control(__UI_NewID).ForeColor = _RGB32(255, 255, 255)
|
||||
Control(__UI_NewID).BackStyle = __UI_Transparent
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
Fireworks = __UI_GetID("Fireworks")
|
||||
Canvas = __UI_GetID("Canvas")
|
||||
MaxFireworksLB = __UI_GetID("MaxFireworksLB")
|
||||
MaxFireworksTrackBar = __UI_GetID("MaxFireworksTrackBar")
|
||||
MaxParticlesLB = __UI_GetID("MaxParticlesLB")
|
||||
MaxParticlesTrackBar = __UI_GetID("MaxParticlesTrackBar")
|
||||
ShowTextCB = __UI_GetID("ShowTextCB")
|
||||
YourTextHereTB = __UI_GetID("YourTextHereTB")
|
||||
HappyNewYearLB = __UI_GetID("HappyNewYearLB")
|
||||
END SUB
|
344
examples/Fireworks2Inform/InForm/InForm.bi
Normal file
344
examples/Fireworks2Inform/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(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
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 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
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER
|
||||
DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG
|
||||
DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/Fireworks2Inform/InForm/InForm.ui
Normal file
8697
examples/Fireworks2Inform/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/Fireworks2Inform/InForm/InFormVersion.bas
Normal file
7
examples/Fireworks2Inform/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/Fireworks2Inform/InForm/xp.uitheme
Normal file
1144
examples/Fireworks2Inform/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
BIN
examples/Fireworks2Inform/distant.wav
Normal file
BIN
examples/Fireworks2Inform/distant.wav
Normal file
Binary file not shown.
344
examples/InFormTicTacToe/InForm/InForm.bi
Normal file
344
examples/InFormTicTacToe/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(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
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 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
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER
|
||||
DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG
|
||||
DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/InFormTicTacToe/InForm/InForm.ui
Normal file
8697
examples/InFormTicTacToe/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/InFormTicTacToe/InForm/InFormVersion.bas
Normal file
7
examples/InFormTicTacToe/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/InFormTicTacToe/InForm/xp.uitheme
Normal file
1144
examples/InFormTicTacToe/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
270
examples/InFormTicTacToe/TicTacToe.bas
Normal file
270
examples/InFormTicTacToe/TicTacToe.bas
Normal file
|
@ -0,0 +1,270 @@
|
|||
': This program uses
|
||||
': InForm - GUI library for QB64 - v1.0
|
||||
': Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
|
||||
Option _Explicit
|
||||
|
||||
Dim Shared ThisTurn As _Byte
|
||||
|
||||
': Controls' IDs: ------------------------------------------------------------------
|
||||
Dim Shared TicTacToe As Long
|
||||
Dim Shared Button1 As Long
|
||||
Dim Shared Button2 As Long
|
||||
Dim Shared Button3 As Long
|
||||
Dim Shared Button4 As Long
|
||||
Dim Shared BUtton5 As Long
|
||||
Dim Shared Button6 As Long
|
||||
Dim Shared Button7 As Long
|
||||
Dim Shared Button8 As Long
|
||||
Dim Shared Button9 As Long
|
||||
|
||||
': External modules: ---------------------------------------------------------------
|
||||
'$INCLUDE:'InForm\InForm.bi'
|
||||
'$INCLUDE:'TicTacToe.frm'
|
||||
|
||||
': Custom functions: ---------------------------------------------------------------
|
||||
Sub MessageBox (message As String, caption As String, icon As String)
|
||||
_Delay 0.2 ' delay a bit to allow InFrom to draw and refresh all comtrols before the modal dialog box takes over
|
||||
_MessageBox caption, message, icon
|
||||
End Sub
|
||||
|
||||
': Event procedures: ---------------------------------------------------------------
|
||||
Sub __UI_BeforeInit
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_OnLoad
|
||||
ThisTurn = 1
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUpdateDisplay
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUnload
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_Click (id As Long)
|
||||
If Control(id).Type = __UI_Type_Button Then
|
||||
If Control(id).Value = 0 Then
|
||||
Control(id).Value = ThisTurn
|
||||
If ThisTurn = 1 Then Caption(id) = "X": ThisTurn = 2 Else Caption(id) = "O": ThisTurn = 1
|
||||
CheckVictory
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub CheckVictory
|
||||
Dim Winner As _Byte
|
||||
|
||||
If Control(Button1).Value = Control(Button2).Value And Control(Button2).Value = Control(Button3).Value Then
|
||||
Winner = Control(Button1).Value
|
||||
ElseIf Control(Button4).Value = Control(BUtton5).Value And Control(BUtton5).Value = Control(Button6).Value Then
|
||||
Winner = Control(Button4).Value
|
||||
ElseIf Control(Button7).Value = Control(Button8).Value And Control(Button8).Value = Control(Button9).Value Then
|
||||
Winner = Control(Button7).Value
|
||||
ElseIf Control(Button1).Value = Control(Button4).Value And Control(Button4).Value = Control(Button7).Value Then
|
||||
Winner = Control(Button1).Value
|
||||
ElseIf Control(Button2).Value = Control(BUtton5).Value And Control(BUtton5).Value = Control(Button8).Value Then
|
||||
Winner = Control(Button2).Value
|
||||
ElseIf Control(Button3).Value = Control(Button6).Value And Control(Button6).Value = Control(Button9).Value Then
|
||||
Winner = Control(Button3).Value
|
||||
ElseIf Control(Button1).Value = Control(BUtton5).Value And Control(BUtton5).Value = Control(Button9).Value Then
|
||||
Winner = Control(Button1).Value
|
||||
ElseIf Control(Button7).Value = Control(BUtton5).Value And Control(BUtton5).Value = Control(Button3).Value Then
|
||||
Winner = Control(Button7).Value
|
||||
End If
|
||||
|
||||
If Winner > 0 Then
|
||||
MessageBox "Player" + Str$(Winner) + " won!", "Tic Tac Toe", "info"
|
||||
System
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseEnter (id As Long)
|
||||
Select Case id
|
||||
Case TicTacToe
|
||||
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseLeave (id As Long)
|
||||
Select Case id
|
||||
Case TicTacToe
|
||||
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusIn (id As Long)
|
||||
Select Case id
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusOut (id As Long)
|
||||
Select Case id
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseDown (id As Long)
|
||||
Select Case id
|
||||
Case TicTacToe
|
||||
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseUp (id As Long)
|
||||
Select Case id
|
||||
Case TicTacToe
|
||||
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_KeyPress (id As Long)
|
||||
Select Case id
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case BUtton5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_TextChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_ValueChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FormResized
|
||||
End Sub
|
||||
|
||||
'$INCLUDE:'InForm\InForm.ui'
|
||||
'$INCLUDE:'InForm\xp.uitheme'
|
55
examples/InFormTicTacToe/TicTacToe.frm
Normal file
55
examples/InFormTicTacToe/TicTacToe.frm
Normal file
|
@ -0,0 +1,55 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - Beta version 8
|
||||
': Fellippe Heitor, 2016-2018 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "TicTacToe", 300, 325, 0, 0, 0)
|
||||
SetCaption __UI_NewID, "Tic tac toe"
|
||||
Control(__UI_NewID).Font = SetFont("segoeui.ttf?arial.ttf", 12)
|
||||
Control(__UI_NewID).CenteredWindow = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button1", 80, 80, 23, 29, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button2", 80, 80, 110, 29, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button3", 80, 80, 197, 29, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button4", 80, 80, 24, 123, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "BUtton5", 80, 80, 111, 123, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button6", 80, 80, 198, 123, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button7", 80, 80, 24, 217, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button8", 80, 80, 111, 217, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "Button9", 80, 80, 198, 217, 0)
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
TicTacToe = __UI_GetID("TicTacToe")
|
||||
Button1 = __UI_GetID("Button1")
|
||||
Button2 = __UI_GetID("Button2")
|
||||
Button3 = __UI_GetID("Button3")
|
||||
Button4 = __UI_GetID("Button4")
|
||||
BUtton5 = __UI_GetID("BUtton5")
|
||||
Button6 = __UI_GetID("Button6")
|
||||
Button7 = __UI_GetID("Button7")
|
||||
Button8 = __UI_GetID("Button8")
|
||||
Button9 = __UI_GetID("Button9")
|
||||
END SUB
|
344
examples/InFormTicTacToe2/InForm/InForm.bi
Normal file
344
examples/InFormTicTacToe2/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(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
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 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
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER
|
||||
DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG
|
||||
DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/InFormTicTacToe2/InForm/InForm.ui
Normal file
8697
examples/InFormTicTacToe2/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/InFormTicTacToe2/InForm/InFormVersion.bas
Normal file
7
examples/InFormTicTacToe2/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/InFormTicTacToe2/InForm/xp.uitheme
Normal file
1144
examples/InFormTicTacToe2/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
189
examples/InFormTicTacToe2/TicTacToe2.bas
Normal file
189
examples/InFormTicTacToe2/TicTacToe2.bas
Normal file
|
@ -0,0 +1,189 @@
|
|||
': This program uses
|
||||
': InForm - GUI library for QB64 - v1.0
|
||||
': Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
|
||||
Option _Explicit
|
||||
|
||||
Dim Shared ThisTurn As _Byte
|
||||
|
||||
': Controls' IDs: ------------------------------------------------------------------
|
||||
Dim Shared TicTacToe2 As Long
|
||||
Dim Shared Button1 As Long
|
||||
Dim Shared Button2 As Long
|
||||
Dim Shared Button3 As Long
|
||||
Dim Shared Button4 As Long
|
||||
Dim Shared Button5 As Long
|
||||
Dim Shared Button6 As Long
|
||||
Dim Shared Button7 As Long
|
||||
Dim Shared Button8 As Long
|
||||
Dim Shared Button9 As Long
|
||||
|
||||
': External modules: ---------------------------------------------------------------
|
||||
'$INCLUDE:'InForm\InForm.bi'
|
||||
'$INCLUDE:'TicTacToe2.frm'
|
||||
|
||||
': Custom functions: ---------------------------------------------------------------
|
||||
Sub MessageBox (message As String, caption As String, icon As String)
|
||||
_Delay 0.2 ' delay a bit to allow InFrom to draw and refresh all comtrols before the modal dialog box takes over
|
||||
_MessageBox caption, message, icon
|
||||
End Sub
|
||||
|
||||
': Event procedures: ---------------------------------------------------------------
|
||||
Sub __UI_BeforeInit
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_OnLoad
|
||||
ThisTurn = 1
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUpdateDisplay
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUnload
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_Click (id As Long)
|
||||
If Control(id).Type = __UI_Type_Label Then
|
||||
If Control(id).Value = 0 Then
|
||||
Control(id).Value = ThisTurn
|
||||
If ThisTurn = 1 Then
|
||||
Caption(id) = "X": ThisTurn = 2
|
||||
Control(id).ForeColor = _RGB32(255, 255, 255)
|
||||
Control(id).BackColor = _RGB32(200, 0, 0)
|
||||
Else
|
||||
Caption(id) = "O": ThisTurn = 1
|
||||
Control(id).BackColor = _RGB32(0, 200, 0)
|
||||
End If
|
||||
CheckVictory
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub CheckVictory
|
||||
Dim Winner As _Byte
|
||||
|
||||
If Control(Button1).Value = Control(Button2).Value And Control(Button2).Value = Control(Button3).Value Then
|
||||
Winner = Control(Button1).Value
|
||||
ElseIf Control(Button4).Value = Control(Button5).Value And Control(Button5).Value = Control(Button6).Value Then
|
||||
Winner = Control(Button4).Value
|
||||
ElseIf Control(Button7).Value = Control(Button8).Value And Control(Button8).Value = Control(Button9).Value Then
|
||||
Winner = Control(Button7).Value
|
||||
ElseIf Control(Button1).Value = Control(Button4).Value And Control(Button4).Value = Control(Button7).Value Then
|
||||
Winner = Control(Button1).Value
|
||||
ElseIf Control(Button2).Value = Control(Button5).Value And Control(Button5).Value = Control(Button8).Value Then
|
||||
Winner = Control(Button2).Value
|
||||
ElseIf Control(Button3).Value = Control(Button6).Value And Control(Button6).Value = Control(Button9).Value Then
|
||||
Winner = Control(Button3).Value
|
||||
ElseIf Control(Button1).Value = Control(Button5).Value And Control(Button5).Value = Control(Button9).Value Then
|
||||
Winner = Control(Button1).Value
|
||||
ElseIf Control(Button7).Value = Control(Button5).Value And Control(Button5).Value = Control(Button3).Value Then
|
||||
Winner = Control(Button7).Value
|
||||
End If
|
||||
|
||||
If Winner > 0 Then
|
||||
MessageBox "Player" + Str$(Winner) + " won!", "Tic Tac Toe", "info"
|
||||
System
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseEnter (id As Long)
|
||||
If Control(id).Type = __UI_Type_Label Then
|
||||
If Control(id).Value = 0 Then
|
||||
Control(id).BackColor = _RGB32(44, 94, 128)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseLeave (id As Long)
|
||||
If Control(id).Type = __UI_Type_Label Then
|
||||
If Control(id).Value = 0 Then
|
||||
Control(id).BackColor = _RGB32(127, 170, 255)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusIn (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusOut (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseDown (id As Long)
|
||||
Select Case id
|
||||
Case TicTacToe2
|
||||
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case Button5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseUp (id As Long)
|
||||
Select Case id
|
||||
Case TicTacToe2
|
||||
|
||||
Case Button1
|
||||
|
||||
Case Button2
|
||||
|
||||
Case Button3
|
||||
|
||||
Case Button4
|
||||
|
||||
Case Button5
|
||||
|
||||
Case Button6
|
||||
|
||||
Case Button7
|
||||
|
||||
Case Button8
|
||||
|
||||
Case Button9
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_KeyPress (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_TextChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_ValueChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FormResized
|
||||
End Sub
|
||||
|
||||
'$INCLUDE:'InForm\InForm.ui'
|
||||
'$INCLUDE:'InForm\xp.uitheme'
|
73
examples/InFormTicTacToe2/TicTacToe2.frm
Normal file
73
examples/InFormTicTacToe2/TicTacToe2.frm
Normal file
|
@ -0,0 +1,73 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - Beta version 8
|
||||
': Fellippe Heitor, 2016-2018 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "TicTacToe2", 300, 325, 0, 0, 0)
|
||||
SetCaption __UI_NewID, "Tic tac toe 2"
|
||||
Control(__UI_NewID).Font = SetFont("cyberbit.ttf?times.ttf?arial.ttf?InForm/resources/NotoMono-Regular.ttf", 48)
|
||||
Control(__UI_NewID).CenteredWindow = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button1", 80, 80, 13, 30, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button2", 80, 80, 111, 30, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button3", 80, 80, 209, 30, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button4", 80, 80, 12, 123, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button5", 80, 80, 110, 123, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button6", 80, 80, 208, 123, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button7", 80, 80, 14, 216, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button8", 80, 80, 112, 216, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Button9", 80, 80, 210, 216, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(127, 170, 255)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
TicTacToe2 = __UI_GetID("TicTacToe2")
|
||||
Button1 = __UI_GetID("Button1")
|
||||
Button2 = __UI_GetID("Button2")
|
||||
Button3 = __UI_GetID("Button3")
|
||||
Button4 = __UI_GetID("Button4")
|
||||
Button5 = __UI_GetID("Button5")
|
||||
Button6 = __UI_GetID("Button6")
|
||||
Button7 = __UI_GetID("Button7")
|
||||
Button8 = __UI_GetID("Button8")
|
||||
Button9 = __UI_GetID("Button9")
|
||||
END SUB
|
344
examples/Stopwatch/InForm/InForm.bi
Normal file
344
examples/Stopwatch/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(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
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 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
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER
|
||||
DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG
|
||||
DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/Stopwatch/InForm/InForm.ui
Normal file
8697
examples/Stopwatch/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/Stopwatch/InForm/InFormVersion.bas
Normal file
7
examples/Stopwatch/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/Stopwatch/InForm/xp.uitheme
Normal file
1144
examples/Stopwatch/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
224
examples/Stopwatch/Stopwatch.bas
Normal file
224
examples/Stopwatch/Stopwatch.bas
Normal file
|
@ -0,0 +1,224 @@
|
|||
': This program uses
|
||||
': InForm - GUI library for QB64 - v1.0
|
||||
': Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
|
||||
Option _Explicit
|
||||
|
||||
': Controls' IDs: ------------------------------------------------------------------
|
||||
Dim Shared Stopwatch As Long
|
||||
Dim Shared TimeLB As Long
|
||||
Dim Shared StartBT As Long
|
||||
Dim Shared LapBT As Long
|
||||
Dim Shared StopBT As Long
|
||||
Dim Shared ListBox1 As Long
|
||||
|
||||
Dim Shared start As Single, Running As _Byte
|
||||
Dim Shared second As Integer, minute As Integer, hour As Integer
|
||||
Dim Shared elapsed As Single
|
||||
|
||||
': External modules: ---------------------------------------------------------------
|
||||
'$INCLUDE:'InForm\InForm.bi'
|
||||
'$INCLUDE:'Stopwatch.frm'
|
||||
|
||||
': Event procedures: ---------------------------------------------------------------
|
||||
Sub __UI_BeforeInit
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_OnLoad
|
||||
__UI_DefaultButtonID = StartBT
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUpdateDisplay
|
||||
If Running Then
|
||||
Dim theTime$
|
||||
|
||||
elapsed = Timer - start
|
||||
If elapsed >= 1 Then
|
||||
second = second + 1
|
||||
elapsed = elapsed - 1
|
||||
start = start + 1
|
||||
If second >= 60 Then
|
||||
second = second - 60
|
||||
minute = minute + 1
|
||||
If minute >= 60 Then
|
||||
minute = minute - 60
|
||||
hour = hour + 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim hour$: hour$ = Right$("00" + LTrim$(Str$(hour)), 2)
|
||||
Dim min$: min$ = Right$("00" + LTrim$(Str$(minute)), 2)
|
||||
Dim sec$: sec$ = Right$("00" + LTrim$(Str$(second)), 2)
|
||||
Dim elapsed$: elapsed$ = Mid$(Str$(elapsed), InStr(Str$(elapsed), ".") + 1) + "000"
|
||||
|
||||
theTime$ = hour$ + ":" + min$ + ":" + sec$ + "," + Left$(elapsed$, 3)
|
||||
|
||||
Caption(TimeLB) = theTime$
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUnload
|
||||
End Sub
|
||||
|
||||
Sub __UI_Click (id As Long)
|
||||
Select Case id
|
||||
Case Stopwatch
|
||||
|
||||
Case TimeLB
|
||||
|
||||
Case StartBT
|
||||
If Running Then
|
||||
Caption(id) = "Start"
|
||||
Running = False
|
||||
Control(StopBT).Disabled = False
|
||||
Control(LapBT).Disabled = True
|
||||
Else
|
||||
Caption(id) = "Pause"
|
||||
start = Timer - elapsed
|
||||
Running = True
|
||||
Control(StopBT).Disabled = True
|
||||
Control(LapBT).Disabled = False
|
||||
End If
|
||||
Case LapBT
|
||||
AddItem ListBox1, Caption(TimeLB)
|
||||
Case StopBT
|
||||
second = 0
|
||||
minute = 0
|
||||
hour = 0
|
||||
elapsed = 0
|
||||
Caption(TimeLB) = "00:00:00,000"
|
||||
ResetList ListBox1
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseEnter (id As Long)
|
||||
Select Case id
|
||||
Case Stopwatch
|
||||
|
||||
Case TimeLB
|
||||
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseLeave (id As Long)
|
||||
Select Case id
|
||||
Case Stopwatch
|
||||
|
||||
Case TimeLB
|
||||
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusIn (id As Long)
|
||||
Select Case id
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusOut (id As Long)
|
||||
Select Case id
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseDown (id As Long)
|
||||
Select Case id
|
||||
Case Stopwatch
|
||||
|
||||
Case TimeLB
|
||||
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseUp (id As Long)
|
||||
Select Case id
|
||||
Case Stopwatch
|
||||
|
||||
Case TimeLB
|
||||
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_KeyPress (id As Long)
|
||||
Select Case id
|
||||
Case StartBT
|
||||
|
||||
Case LapBT
|
||||
|
||||
Case StopBT
|
||||
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_TextChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_ValueChanged (id As Long)
|
||||
Select Case id
|
||||
Case ListBox1
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FormResized
|
||||
|
||||
End Sub
|
||||
|
||||
'$INCLUDE:'InForm\InForm.ui'
|
||||
'$INCLUDE:'InForm\xp.uitheme'
|
57
examples/Stopwatch/Stopwatch.frm
Normal file
57
examples/Stopwatch/Stopwatch.frm
Normal file
|
@ -0,0 +1,57 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - Beta version 8
|
||||
': Fellippe Heitor, 2016-2018 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Stopwatch", 806, 215, 0, 0, 0)
|
||||
SetCaption __UI_NewID, "Stopwatch"
|
||||
Control(__UI_NewID).Stretch = False
|
||||
Control(__UI_NewID).Font = SetFont("arial.ttf", 12)
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TimeLB", 780, 94, 13, 10, 0)
|
||||
SetCaption __UI_NewID, "00:00:00,000"
|
||||
Control(__UI_NewID).Stretch = False
|
||||
Control(__UI_NewID).Font = SetFont("COUR.TTF", 78)
|
||||
Control(__UI_NewID).BorderColor = _RGB32(0, 0, 0)
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "StartBT", 80, 23, 278, 116, 0)
|
||||
__UI_DefaultButtonID = __UI_NewID
|
||||
SetCaption __UI_NewID, "Start"
|
||||
Control(__UI_NewID).Stretch = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "LapBT", 80, 23, 363, 116, 0)
|
||||
SetCaption __UI_NewID, "Lap"
|
||||
Control(__UI_NewID).Stretch = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).Disabled = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "StopBT", 80, 23, 448, 116, 0)
|
||||
SetCaption __UI_NewID, "Reset"
|
||||
Control(__UI_NewID).Stretch = False
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_ListBox, "ListBox1", 249, 58, 278, 149, 0)
|
||||
Control(__UI_NewID).Stretch = False
|
||||
Control(__UI_NewID).Font = SetFont("COUR.TTF", 12)
|
||||
Control(__UI_NewID).HasBorder = True
|
||||
Control(__UI_NewID).CanHaveFocus = True
|
||||
Control(__UI_NewID).AutoScroll = True
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
Stopwatch = __UI_GetID("Stopwatch")
|
||||
TimeLB = __UI_GetID("TimeLB")
|
||||
StartBT = __UI_GetID("StartBT")
|
||||
LapBT = __UI_GetID("LapBT")
|
||||
StopBT = __UI_GetID("StopBT")
|
||||
ListBox1 = __UI_GetID("ListBox1")
|
||||
END SUB
|
344
examples/WordClock/InForm/InForm.bi
Normal file
344
examples/WordClock/InForm/InForm.bi
Normal file
|
@ -0,0 +1,344 @@
|
|||
'InForm - GUI library for QB64
|
||||
'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
'
|
||||
|
||||
$If VERSION < 3.8 Then
|
||||
$Error This requires the latest version of QB64-PE from https://github.com/QB64-Phoenix-Edition/QB64pe/releases
|
||||
$End If
|
||||
|
||||
DECLARE LIBRARY
|
||||
FUNCTION __UI_GetPID ALIAS getpid ()
|
||||
END DECLARE
|
||||
|
||||
DECLARE CUSTOMTYPE LIBRARY
|
||||
SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
DECLARE LIBRARY
|
||||
FUNCTION GetSystemMetrics& (BYVAL WhichMetric&)
|
||||
END DECLARE
|
||||
|
||||
CONST __UI_SM_SWAPBUTTON = 23
|
||||
$END IF
|
||||
|
||||
$SCREENHIDE
|
||||
_CONTROLCHR OFF
|
||||
|
||||
TYPE __UI_ControlTYPE
|
||||
ID AS LONG
|
||||
ParentID AS LONG
|
||||
PreviousParentID AS LONG
|
||||
ContextMenuID AS LONG
|
||||
Type AS INTEGER
|
||||
Name AS STRING * 40
|
||||
ParentName AS STRING * 40
|
||||
SubMenu AS _BYTE
|
||||
MenuPanelID AS LONG
|
||||
SourceControl AS LONG
|
||||
Top AS INTEGER
|
||||
Left AS INTEGER
|
||||
Width AS INTEGER
|
||||
Height AS INTEGER
|
||||
Canvas AS LONG
|
||||
HelperCanvas AS LONG
|
||||
TransparentColor AS _UNSIGNED LONG
|
||||
Stretch AS _BYTE
|
||||
PreviousStretch AS _BYTE
|
||||
Font AS INTEGER
|
||||
PreviousFont AS INTEGER
|
||||
BackColor AS _UNSIGNED LONG
|
||||
ForeColor AS _UNSIGNED LONG
|
||||
SelectedForeColor AS _UNSIGNED LONG
|
||||
SelectedBackColor AS _UNSIGNED LONG
|
||||
BackStyle AS _BYTE
|
||||
HasBorder AS _BYTE
|
||||
BorderSize AS INTEGER
|
||||
Padding AS INTEGER
|
||||
Encoding AS LONG
|
||||
Align AS _BYTE
|
||||
PrevAlign AS _BYTE
|
||||
VAlign AS _BYTE
|
||||
PrevVAlign AS _BYTE
|
||||
BorderColor AS _UNSIGNED LONG
|
||||
Value AS _FLOAT
|
||||
PreviousValue AS _FLOAT
|
||||
Min AS _FLOAT
|
||||
PrevMin AS _FLOAT
|
||||
Max AS _FLOAT
|
||||
PrevMax AS _FLOAT
|
||||
Interval AS _FLOAT
|
||||
PrevInterval AS _FLOAT
|
||||
MinInterval AS _FLOAT
|
||||
PrevMinInterval AS _FLOAT
|
||||
HotKey AS INTEGER
|
||||
HotKeyOffset AS INTEGER
|
||||
HotKeyPosition AS INTEGER
|
||||
ShowPercentage AS _BYTE
|
||||
AutoScroll AS _BYTE
|
||||
AutoSize AS _BYTE
|
||||
InputViewStart AS LONG
|
||||
PreviousInputViewStart AS LONG
|
||||
LastVisibleItem AS INTEGER
|
||||
ItemHeight AS INTEGER
|
||||
HasVScrollbar AS _BYTE
|
||||
VScrollbarButton2Top AS INTEGER
|
||||
HoveringVScrollbarButton AS _BYTE
|
||||
ThumbHeight AS INTEGER
|
||||
ThumbTop AS INTEGER
|
||||
VScrollbarRatio AS SINGLE
|
||||
Cursor AS LONG
|
||||
PasswordField AS _BYTE
|
||||
PrevCursor AS LONG
|
||||
FieldArea AS LONG
|
||||
PreviousFieldArea AS LONG
|
||||
TextIsSelected AS _BYTE
|
||||
BypassSelectOnFocus AS _BYTE
|
||||
Multiline AS _BYTE
|
||||
NumericOnly AS _BYTE
|
||||
FirstVisibleLine AS LONG
|
||||
PrevFirstVisibleLine AS LONG
|
||||
CurrentLine AS LONG
|
||||
PrevCurrentLine AS LONG
|
||||
VisibleCursor AS LONG
|
||||
PrevVisibleCursor AS LONG
|
||||
ControlIsSelected AS _BYTE
|
||||
LeftOffsetFromFirstSelected AS INTEGER
|
||||
TopOffsetFromFirstSelected AS INTEGER
|
||||
SelectionLength AS LONG
|
||||
SelectionStart AS LONG
|
||||
WordWrap AS _BYTE
|
||||
CanResize AS _BYTE
|
||||
CanHaveFocus AS _BYTE
|
||||
Disabled AS _BYTE
|
||||
Hidden AS _BYTE
|
||||
PreviouslyHidden AS _BYTE
|
||||
CenteredWindow AS _BYTE
|
||||
ControlState AS _BYTE
|
||||
ChildrenRedrawn AS _BYTE
|
||||
FocusState AS LONG
|
||||
LastChange AS SINGLE
|
||||
Redraw AS _BYTE
|
||||
BulletStyle AS _BYTE
|
||||
MenuItemGroup AS INTEGER
|
||||
KeyCombo AS LONG
|
||||
BoundTo AS LONG
|
||||
BoundProperty AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_Types
|
||||
Name AS STRING * 16
|
||||
Count AS LONG
|
||||
TurnsInto AS INTEGER
|
||||
DefaultHeight AS INTEGER
|
||||
MinimumHeight AS INTEGER
|
||||
DefaultWidth AS INTEGER
|
||||
MinimumWidth AS INTEGER
|
||||
RestrictResize AS _BYTE
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_ThemeImagesType
|
||||
FileName AS STRING * 32
|
||||
Handle AS LONG
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_WordWrapHistoryType
|
||||
StringSlot AS LONG
|
||||
Width AS INTEGER
|
||||
LongestLine AS INTEGER
|
||||
Font AS LONG
|
||||
TotalLines AS INTEGER
|
||||
END TYPE
|
||||
|
||||
TYPE __UI_KeyCombos
|
||||
Combo AS STRING * 14 ' "CTRL+SHIFT+F12"
|
||||
FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12"
|
||||
ControlID AS LONG
|
||||
END TYPE
|
||||
|
||||
REDIM SHARED Caption(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING
|
||||
REDIM SHARED Text(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED Mask(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempMask(0 TO 100) AS STRING
|
||||
REDIM SHARED ToolTip(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_TempTips(0 TO 100) AS STRING
|
||||
REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE
|
||||
REDIM SHARED ControlDrawOrder(0) AS LONG
|
||||
REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType
|
||||
REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING
|
||||
REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType
|
||||
REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(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
|
||||
|
||||
DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE
|
||||
DIM SHARED table1252$(0 TO 255), table437$(0 TO 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
|
||||
DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE
|
||||
DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG
|
||||
DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG
|
||||
DIM SHARED __UI_PreviousMouseDownOnID AS LONG
|
||||
DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG
|
||||
DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE
|
||||
DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$
|
||||
DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE
|
||||
DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER
|
||||
DIM SHARED __UI_DefaultButtonID AS LONG
|
||||
DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE
|
||||
DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE
|
||||
DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG
|
||||
DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG
|
||||
DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG
|
||||
DIM SHARED __UI_ResizeHandleHover AS _BYTE
|
||||
DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG
|
||||
DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG
|
||||
DIM SHARED __UI_StateHasChanged AS _BYTE
|
||||
DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER
|
||||
DIM SHARED __UI_DraggingThumbOnID AS LONG
|
||||
DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE
|
||||
DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE
|
||||
DIM SHARED __UI_ExitTriggered AS _BYTE
|
||||
DIM SHARED __UI_Loaded AS _BYTE
|
||||
DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER
|
||||
DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG
|
||||
DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE
|
||||
DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE
|
||||
DIM SHARED __UI_TopMenuBarItem AS LONG
|
||||
DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG
|
||||
DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER
|
||||
DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG
|
||||
DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER
|
||||
DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER
|
||||
DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER
|
||||
DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE
|
||||
DIM SHARED __UI_CurrentTitle AS STRING
|
||||
DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG
|
||||
DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG
|
||||
DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE
|
||||
DIM SHARED __UI_LastRenderedCharCount AS LONG
|
||||
DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER
|
||||
DIM SHARED __UI_SelectionRectangle AS _BYTE
|
||||
DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE
|
||||
DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE
|
||||
DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE
|
||||
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
|
||||
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
|
||||
DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER
|
||||
DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER
|
||||
DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER
|
||||
DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER
|
||||
DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE
|
||||
DIM SHARED __UI_ContextMenuSourceID AS LONG
|
||||
DIM SHARED __UI_FKey(1 TO 12) AS LONG
|
||||
|
||||
'Control types: -----------------------------------------------
|
||||
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
|
||||
__UI_Type(__UI_Type_Form).Name = "Form"
|
||||
|
||||
__UI_Type(__UI_Type_Frame).Name = "Frame"
|
||||
__UI_Type(__UI_Type_Frame).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_Frame).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_Button).Name = "Button"
|
||||
__UI_Type(__UI_Type_Button).DefaultWidth = 80
|
||||
__UI_Type(__UI_Type_Button).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_Label).Name = "Label"
|
||||
__UI_Type(__UI_Type_Label).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_Label).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_CheckBox).Name = "CheckBox"
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_CheckBox).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_CheckBox).TurnsInto = __UI_Type_ToggleSwitch
|
||||
|
||||
__UI_Type(__UI_Type_RadioButton).Name = "RadioButton"
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultWidth = 150
|
||||
__UI_Type(__UI_Type_RadioButton).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_TextBox).Name = "TextBox"
|
||||
__UI_Type(__UI_Type_TextBox).DefaultWidth = 120
|
||||
__UI_Type(__UI_Type_TextBox).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ProgressBar).Name = "ProgressBar"
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_ProgressBar).DefaultHeight = 23
|
||||
|
||||
__UI_Type(__UI_Type_ListBox).Name = "ListBox"
|
||||
__UI_Type(__UI_Type_ListBox).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_ListBox).DefaultHeight = 200
|
||||
__UI_Type(__UI_Type_ListBox).TurnsInto = __UI_Type_DropdownList
|
||||
|
||||
__UI_Type(__UI_Type_DropdownList).Name = "DropdownList"
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultWidth = 200
|
||||
__UI_Type(__UI_Type_DropdownList).DefaultHeight = 23
|
||||
__UI_Type(__UI_Type_DropdownList).TurnsInto = __UI_Type_ListBox
|
||||
|
||||
__UI_Type(__UI_Type_MenuBar).Name = "MenuBar"
|
||||
__UI_Type(__UI_Type_MenuBar).TurnsInto = __UI_Type_ContextMenu
|
||||
__UI_Type(__UI_Type_MenuBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuItem).Name = "MenuItem"
|
||||
__UI_Type(__UI_Type_MenuItem).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_MenuPanel).Name = "MenuPanel"
|
||||
|
||||
__UI_Type(__UI_Type_PictureBox).Name = "PictureBox"
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultWidth = 230
|
||||
__UI_Type(__UI_Type_PictureBox).DefaultHeight = 150
|
||||
|
||||
__UI_Type(__UI_Type_TrackBar).Name = "TrackBar"
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultWidth = 300
|
||||
__UI_Type(__UI_Type_TrackBar).DefaultHeight = 40
|
||||
__UI_Type(__UI_Type_TrackBar).MinimumHeight = 30
|
||||
__UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||
|
||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||
|
||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||
|
||||
__UI_Type(__UI_Type_ToggleSwitch).Name = "ToggleSwitch"
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultWidth = 40
|
||||
__UI_Type(__UI_Type_ToggleSwitch).DefaultHeight = 17
|
||||
__UI_Type(__UI_Type_ToggleSwitch).TurnsInto = __UI_Type_CheckBox
|
||||
__UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize
|
||||
'--------------------------------------------------------------
|
||||
|
||||
__UI_RestoreFKeys
|
||||
|
||||
CONST False = 0, True = Not False
|
||||
|
||||
'$INCLUDE:'InFormVersion.bas'
|
||||
__UI_SubMenuDelay = .4
|
||||
__UI_SnapDistance = 5
|
||||
__UI_SnapDistanceFromForm = 10
|
||||
__UI_MaxBorderSize = 10
|
||||
__UI_Font8Offset = 5
|
||||
__UI_Font16Offset = 3
|
||||
__UI_ClipboardCheck$ = "InForm" + STRING$(2, 10) + "BEGIN CONTROL DATA" + CHR$(10) + STRING$(60, 45) + CHR$(10)
|
||||
|
||||
__UI_ThemeSetup
|
||||
__UI_InternalMenus
|
||||
__UI_LoadForm
|
||||
|
||||
__UI_Init
|
||||
|
||||
'Main loop
|
||||
DO
|
||||
_LIMIT 1
|
||||
LOOP
|
||||
|
||||
SYSTEM
|
||||
|
||||
__UI_ErrorHandler:
|
||||
RESUME NEXT
|
||||
|
8697
examples/WordClock/InForm/InForm.ui
Normal file
8697
examples/WordClock/InForm/InForm.ui
Normal file
File diff suppressed because it is too large
Load diff
7
examples/WordClock/InForm/InFormVersion.bas
Normal file
7
examples/WordClock/InForm/InFormVersion.bas
Normal file
|
@ -0,0 +1,7 @@
|
|||
'Starting with v1.0, __UI_VersionNumber is actually the current build.
|
||||
|
||||
CONST __UI_Version = "v1.5"
|
||||
CONST __UI_VersionNumber = 1
|
||||
CONST __UI_VersionIsBeta = 1
|
||||
CONST __UI_CopyrightSpan = "2016-2023"
|
||||
|
1144
examples/WordClock/InForm/xp.uitheme
Normal file
1144
examples/WordClock/InForm/xp.uitheme
Normal file
File diff suppressed because it is too large
Load diff
496
examples/WordClock/WordClock.bas
Normal file
496
examples/WordClock/WordClock.bas
Normal file
|
@ -0,0 +1,496 @@
|
|||
': This program uses
|
||||
': InForm - GUI library for QB64 - v1.0
|
||||
': Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
|
||||
Option _Explicit
|
||||
|
||||
': Controls' IDs: ------------------------------------------------------------------
|
||||
Dim Shared WordClock As Long
|
||||
Dim Shared ITISLB As Long
|
||||
Dim Shared HALFLB As Long
|
||||
Dim Shared TENLB As Long
|
||||
Dim Shared QUARTERLB As Long
|
||||
Dim Shared TWENTYLB As Long
|
||||
Dim Shared FIVELB As Long
|
||||
Dim Shared MINUTESLB As Long
|
||||
Dim Shared TOLB As Long
|
||||
Dim Shared PASTLB As Long
|
||||
Dim Shared TWOLB As Long
|
||||
Dim Shared THREELB As Long
|
||||
Dim Shared ONELB As Long
|
||||
Dim Shared FOURLB As Long
|
||||
Dim Shared FIVELB2 As Long
|
||||
Dim Shared SIXLB As Long
|
||||
Dim Shared SEVENLB As Long
|
||||
Dim Shared EIGHTLB As Long
|
||||
Dim Shared NINELB As Long
|
||||
Dim Shared TENLB2 As Long
|
||||
Dim Shared ELEVENLB As Long
|
||||
Dim Shared TWELVELB As Long
|
||||
Dim Shared OCLOCKLB As Long
|
||||
Dim Shared DotsLB As Long
|
||||
Dim Shared BackDots As Long
|
||||
|
||||
Dim Shared Word(1 To 22) As Long
|
||||
|
||||
': External modules: ---------------------------------------------------------------
|
||||
'$INCLUDE:'InForm\InForm.bi'
|
||||
'$INCLUDE:'WordClock.frm'
|
||||
|
||||
': Event procedures: ---------------------------------------------------------------
|
||||
Sub __UI_BeforeInit
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_OnLoad
|
||||
Word(1) = ITISLB
|
||||
Word(2) = HALFLB
|
||||
Word(3) = TENLB
|
||||
Word(4) = QUARTERLB
|
||||
Word(5) = TWENTYLB
|
||||
Word(6) = FIVELB
|
||||
Word(7) = MINUTESLB
|
||||
Word(8) = TOLB
|
||||
Word(9) = PASTLB
|
||||
Word(10) = TWOLB
|
||||
Word(11) = THREELB
|
||||
Word(12) = ONELB
|
||||
Word(13) = FOURLB
|
||||
Word(14) = FIVELB2
|
||||
Word(15) = SIXLB
|
||||
Word(16) = SEVENLB
|
||||
Word(17) = EIGHTLB
|
||||
Word(18) = NINELB
|
||||
Word(19) = TENLB2
|
||||
Word(20) = ELEVENLB
|
||||
Word(21) = TWELVELB
|
||||
Word(22) = OCLOCKLB
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUpdateDisplay
|
||||
'This event occurs at approximately 30 frames per second.
|
||||
'You can change the update frequency by calling SetFrameRate DesiredRate%
|
||||
|
||||
Dim i As Integer, h As Integer, m As Integer
|
||||
Dim dots As Integer
|
||||
Static prevH As Integer, prevM As Integer
|
||||
|
||||
h = Val(Left$(Time$, 2))
|
||||
m = Val(Mid$(Time$, 4, 2))
|
||||
|
||||
If h = prevH And m = prevM Then Exit Sub
|
||||
|
||||
prevH = h
|
||||
prevM = m
|
||||
switchOffAllWords
|
||||
|
||||
switchOn ITISLB
|
||||
switchOn MINUTESLB
|
||||
Select Case m
|
||||
Case 0 To 4
|
||||
switchOn OCLOCKLB
|
||||
switchOff MINUTESLB
|
||||
dots = m
|
||||
Case 5 To 9
|
||||
switchOn FIVELB
|
||||
switchOn PASTLB
|
||||
dots = m - 5
|
||||
Case 10 To 14
|
||||
switchOn TENLB
|
||||
switchOn PASTLB
|
||||
dots = m - 10
|
||||
Case 15 To 19
|
||||
switchOn QUARTERLB
|
||||
switchOff MINUTESLB
|
||||
switchOn PASTLB
|
||||
dots = m - 15
|
||||
Case 20 To 24
|
||||
switchOn TWENTYLB
|
||||
switchOn PASTLB
|
||||
dots = m - 20
|
||||
Case 25 To 29
|
||||
switchOn TWENTYLB
|
||||
switchOn FIVELB
|
||||
switchOn PASTLB
|
||||
dots = m - 25
|
||||
Case 30 To 34
|
||||
switchOn HALFLB
|
||||
switchOff MINUTESLB
|
||||
switchOn PASTLB
|
||||
dots = m - 30
|
||||
Case 35 To 39
|
||||
switchOn TWENTYLB
|
||||
switchOn FIVELB
|
||||
switchOn TOLB
|
||||
dots = m - 35
|
||||
Case 40 To 44
|
||||
switchOn TWENTYLB
|
||||
switchOn TOLB
|
||||
dots = m - 40
|
||||
Case 45 To 49
|
||||
switchOn QUARTERLB
|
||||
switchOff MINUTESLB
|
||||
switchOn TOLB
|
||||
dots = m - 45
|
||||
Case 50 To 54
|
||||
switchOn TENLB
|
||||
switchOn TOLB
|
||||
dots = m - 50
|
||||
Case 55 To 59
|
||||
switchOn FIVELB
|
||||
switchOn TOLB
|
||||
dots = m - 55
|
||||
End Select
|
||||
|
||||
Caption(DotsLB) = ""
|
||||
For i = 1 To dots
|
||||
Caption(DotsLB) = Caption(DotsLB) + "* "
|
||||
Next
|
||||
|
||||
If m >= 35 Then
|
||||
h = h + 1
|
||||
End If
|
||||
|
||||
Select Case h
|
||||
Case 1, 13
|
||||
switchOn ONELB
|
||||
Case 2, 14
|
||||
switchOn TWOLB
|
||||
Case 3, 15
|
||||
switchOn THREELB
|
||||
Case 4, 16
|
||||
switchOn FOURLB
|
||||
Case 5, 17
|
||||
switchOn FIVELB2
|
||||
Case 6, 18
|
||||
switchOn SIXLB
|
||||
Case 7, 19
|
||||
switchOn SEVENLB
|
||||
Case 8, 20
|
||||
switchOn EIGHTLB
|
||||
Case 9, 21
|
||||
switchOn NINELB
|
||||
Case 10, 22
|
||||
switchOn TENLB2
|
||||
Case 11, 23
|
||||
switchOn ELEVENLB
|
||||
Case 0, 12
|
||||
switchOn TWELVELB
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub switchOffAllWords
|
||||
Dim i As Integer
|
||||
For i = 1 To UBound(Word)
|
||||
switchOff Word(i)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Sub switchOn (this As Long)
|
||||
Control(this).ForeColor = _RGB32(111, 205, 0)
|
||||
Control(this).Redraw = True
|
||||
End Sub
|
||||
|
||||
Sub switchOff (this As Long)
|
||||
Control(this).ForeColor = _RGB32(0, 39, 0)
|
||||
Control(this).Redraw = True
|
||||
End Sub
|
||||
|
||||
Sub __UI_BeforeUnload
|
||||
'If you set __UI_UnloadSignal = False here you can
|
||||
'cancel the user's request to close.
|
||||
|
||||
End Sub
|
||||
|
||||
Sub __UI_Click (id As Long)
|
||||
Select Case id
|
||||
Case WordClock
|
||||
|
||||
Case ITISLB
|
||||
|
||||
Case HALFLB
|
||||
|
||||
Case TENLB
|
||||
|
||||
Case QUARTERLB
|
||||
|
||||
Case TWENTYLB
|
||||
|
||||
Case FIVELB
|
||||
|
||||
Case MINUTESLB
|
||||
|
||||
Case TOLB
|
||||
|
||||
Case PASTLB
|
||||
|
||||
Case TWOLB
|
||||
|
||||
Case THREELB
|
||||
|
||||
Case ONELB
|
||||
|
||||
Case FOURLB
|
||||
|
||||
Case FIVELB2
|
||||
|
||||
Case SIXLB
|
||||
|
||||
Case SEVENLB
|
||||
|
||||
Case EIGHTLB
|
||||
|
||||
Case NINELB
|
||||
|
||||
Case TENLB2
|
||||
|
||||
Case ELEVENLB
|
||||
|
||||
Case TWELVELB
|
||||
|
||||
Case OCLOCKLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseEnter (id As Long)
|
||||
Select Case id
|
||||
Case WordClock
|
||||
|
||||
Case ITISLB
|
||||
|
||||
Case HALFLB
|
||||
|
||||
Case TENLB
|
||||
|
||||
Case QUARTERLB
|
||||
|
||||
Case TWENTYLB
|
||||
|
||||
Case FIVELB
|
||||
|
||||
Case MINUTESLB
|
||||
|
||||
Case TOLB
|
||||
|
||||
Case PASTLB
|
||||
|
||||
Case TWOLB
|
||||
|
||||
Case THREELB
|
||||
|
||||
Case ONELB
|
||||
|
||||
Case FOURLB
|
||||
|
||||
Case FIVELB2
|
||||
|
||||
Case SIXLB
|
||||
|
||||
Case SEVENLB
|
||||
|
||||
Case EIGHTLB
|
||||
|
||||
Case NINELB
|
||||
|
||||
Case TENLB2
|
||||
|
||||
Case ELEVENLB
|
||||
|
||||
Case TWELVELB
|
||||
|
||||
Case OCLOCKLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseLeave (id As Long)
|
||||
Select Case id
|
||||
Case WordClock
|
||||
|
||||
Case ITISLB
|
||||
|
||||
Case HALFLB
|
||||
|
||||
Case TENLB
|
||||
|
||||
Case QUARTERLB
|
||||
|
||||
Case TWENTYLB
|
||||
|
||||
Case FIVELB
|
||||
|
||||
Case MINUTESLB
|
||||
|
||||
Case TOLB
|
||||
|
||||
Case PASTLB
|
||||
|
||||
Case TWOLB
|
||||
|
||||
Case THREELB
|
||||
|
||||
Case ONELB
|
||||
|
||||
Case FOURLB
|
||||
|
||||
Case FIVELB2
|
||||
|
||||
Case SIXLB
|
||||
|
||||
Case SEVENLB
|
||||
|
||||
Case EIGHTLB
|
||||
|
||||
Case NINELB
|
||||
|
||||
Case TENLB2
|
||||
|
||||
Case ELEVENLB
|
||||
|
||||
Case TWELVELB
|
||||
|
||||
Case OCLOCKLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusIn (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FocusOut (id As Long)
|
||||
'This event occurs right before a control loses focus.
|
||||
'To prevent a control from losing focus, set __UI_KeepFocus = True below.
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseDown (id As Long)
|
||||
Select Case id
|
||||
Case WordClock
|
||||
|
||||
Case ITISLB
|
||||
|
||||
Case HALFLB
|
||||
|
||||
Case TENLB
|
||||
|
||||
Case QUARTERLB
|
||||
|
||||
Case TWENTYLB
|
||||
|
||||
Case FIVELB
|
||||
|
||||
Case MINUTESLB
|
||||
|
||||
Case TOLB
|
||||
|
||||
Case PASTLB
|
||||
|
||||
Case TWOLB
|
||||
|
||||
Case THREELB
|
||||
|
||||
Case ONELB
|
||||
|
||||
Case FOURLB
|
||||
|
||||
Case FIVELB2
|
||||
|
||||
Case SIXLB
|
||||
|
||||
Case SEVENLB
|
||||
|
||||
Case EIGHTLB
|
||||
|
||||
Case NINELB
|
||||
|
||||
Case TENLB2
|
||||
|
||||
Case ELEVENLB
|
||||
|
||||
Case TWELVELB
|
||||
|
||||
Case OCLOCKLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_MouseUp (id As Long)
|
||||
Select Case id
|
||||
Case WordClock
|
||||
|
||||
Case ITISLB
|
||||
|
||||
Case HALFLB
|
||||
|
||||
Case TENLB
|
||||
|
||||
Case QUARTERLB
|
||||
|
||||
Case TWENTYLB
|
||||
|
||||
Case FIVELB
|
||||
|
||||
Case MINUTESLB
|
||||
|
||||
Case TOLB
|
||||
|
||||
Case PASTLB
|
||||
|
||||
Case TWOLB
|
||||
|
||||
Case THREELB
|
||||
|
||||
Case ONELB
|
||||
|
||||
Case FOURLB
|
||||
|
||||
Case FIVELB2
|
||||
|
||||
Case SIXLB
|
||||
|
||||
Case SEVENLB
|
||||
|
||||
Case EIGHTLB
|
||||
|
||||
Case NINELB
|
||||
|
||||
Case TENLB2
|
||||
|
||||
Case ELEVENLB
|
||||
|
||||
Case TWELVELB
|
||||
|
||||
Case OCLOCKLB
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_KeyPress (id As Long)
|
||||
'When this event is fired, __UI_KeyHit will contain the code of the key hit.
|
||||
'You can change it and even cancel it by making it = 0
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_TextChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_ValueChanged (id As Long)
|
||||
Select Case id
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub __UI_FormResized
|
||||
|
||||
End Sub
|
||||
|
||||
'$INCLUDE:'InForm\InForm.ui'
|
||||
'$INCLUDE:'InForm\xp.uitheme'
|
189
examples/WordClock/WordClock.frm
Normal file
189
examples/WordClock/WordClock.frm
Normal file
|
@ -0,0 +1,189 @@
|
|||
': This form was generated by
|
||||
': InForm - GUI library for QB64 - Beta version 8
|
||||
': Fellippe Heitor, 2016-2018 - fellippe@qb64.org - @fellippeheitor
|
||||
': https://github.com/FellippeHeitor/InForm
|
||||
'-----------------------------------------------------------
|
||||
SUB __UI_LoadForm
|
||||
|
||||
DIM __UI_NewID AS LONG
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Form, "WordClock", 325, 442, 0, 0, 0)
|
||||
SetCaption __UI_NewID, "Word Clock"
|
||||
Control(__UI_NewID).Font = SetFont("arial.ttf", 12)
|
||||
Control(__UI_NewID).ForeColor = _RGB32(0, 39, 0)
|
||||
Control(__UI_NewID).BackColor = _RGB32(6, 22, 6)
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "ITISLB", 84, 41, 9, 10, 0)
|
||||
SetCaption __UI_NewID, "IT IS"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "HALFLB", 82, 41, 131, 10, 0)
|
||||
SetCaption __UI_NewID, "HALF"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TENLB", 63, 41, 251, 10, 0)
|
||||
SetCaption __UI_NewID, "TEN"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "QUARTERLB", 154, 41, 9, 56, 0)
|
||||
SetCaption __UI_NewID, "QUARTER"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TWENTYLB", 135, 41, 179, 56, 0)
|
||||
SetCaption __UI_NewID, "TWENTY"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "FIVELB", 71, 41, 9, 102, 0)
|
||||
SetCaption __UI_NewID, "FIVE"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "MINUTESLB", 143, 41, 104, 102, 0)
|
||||
SetCaption __UI_NewID, "MINUTES"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TOLB", 43, 41, 271, 102, 0)
|
||||
SetCaption __UI_NewID, "TO"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "PASTLB", 80, 41, 9, 148, 0)
|
||||
SetCaption __UI_NewID, "PAST"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TWOLB", 76, 41, 110, 148, 0)
|
||||
SetCaption __UI_NewID, "TWO"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "THREELB", 107, 41, 207, 148, 0)
|
||||
SetCaption __UI_NewID, "THREE"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "ONELB", 69, 41, 9, 194, 0)
|
||||
SetCaption __UI_NewID, "ONE"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "FOURLB", 91, 41, 117, 194, 0)
|
||||
SetCaption __UI_NewID, "FOUR"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "FIVELB2", 71, 41, 247, 194, 0)
|
||||
SetCaption __UI_NewID, "FIVE"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "SIXLB", 51, 41, 9, 240, 0)
|
||||
SetCaption __UI_NewID, "SIX"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "SEVENLB", 107, 41, 85, 240, 0)
|
||||
SetCaption __UI_NewID, "SEVEN"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "EIGHTLB", 97, 41, 217, 240, 0)
|
||||
SetCaption __UI_NewID, "EIGHT"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "NINELB", 76, 41, 9, 286, 0)
|
||||
SetCaption __UI_NewID, "NINE"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TENLB2", 63, 41, 105, 286, 0)
|
||||
SetCaption __UI_NewID, "TEN"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "ELEVENLB", 125, 41, 188, 286, 0)
|
||||
SetCaption __UI_NewID, "ELEVEN"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "TWELVELB", 130, 41, 9, 332, 0)
|
||||
SetCaption __UI_NewID, "TWELVE"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "OCLOCKLB", 141, 41, 173, 332, 0)
|
||||
SetCaption __UI_NewID, "O'CLOCK"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 32)
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
Control(__UI_NewID).AutoSize = True
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "BackDots", 100, 52, 113, 390, 0)
|
||||
SetCaption __UI_NewID, "* * * *"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 42)
|
||||
Control(__UI_NewID).Align = __UI_Center
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
__UI_NewID = __UI_NewControl(__UI_Type_Label, "DotsLB", 100, 52, 113, 390, 0)
|
||||
SetCaption __UI_NewID, "* * * *"
|
||||
Control(__UI_NewID).Font = SetFont("ARIAL.TTF", 42)
|
||||
Control(__UI_NewID).ForeColor = _RGB32(111, 205, 0)
|
||||
Control(__UI_NewID).BackStyle = __UI_Transparent
|
||||
Control(__UI_NewID).VAlign = __UI_Middle
|
||||
|
||||
END SUB
|
||||
|
||||
SUB __UI_AssignIDs
|
||||
WordClock = __UI_GetID("WordClock")
|
||||
ITISLB = __UI_GetID("ITISLB")
|
||||
HALFLB = __UI_GetID("HALFLB")
|
||||
TENLB = __UI_GetID("TENLB")
|
||||
QUARTERLB = __UI_GetID("QUARTERLB")
|
||||
TWENTYLB = __UI_GetID("TWENTYLB")
|
||||
FIVELB = __UI_GetID("FIVELB")
|
||||
MINUTESLB = __UI_GetID("MINUTESLB")
|
||||
TOLB = __UI_GetID("TOLB")
|
||||
PASTLB = __UI_GetID("PASTLB")
|
||||
TWOLB = __UI_GetID("TWOLB")
|
||||
THREELB = __UI_GetID("THREELB")
|
||||
ONELB = __UI_GetID("ONELB")
|
||||
FOURLB = __UI_GetID("FOURLB")
|
||||
FIVELB2 = __UI_GetID("FIVELB2")
|
||||
SIXLB = __UI_GetID("SIXLB")
|
||||
SEVENLB = __UI_GetID("SEVENLB")
|
||||
EIGHTLB = __UI_GetID("EIGHTLB")
|
||||
NINELB = __UI_GetID("NINELB")
|
||||
TENLB2 = __UI_GetID("TENLB2")
|
||||
ELEVENLB = __UI_GetID("ELEVENLB")
|
||||
TWELVELB = __UI_GetID("TWELVELB")
|
||||
OCLOCKLB = __UI_GetID("OCLOCKLB")
|
||||
BackDots = __UI_GetID("BackDots")
|
||||
DotsLB = __UI_GetID("DotsLB")
|
||||
END SUB
|
Loading…
Reference in a new issue