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

Removed __UI_ from key constants and methods. Also:

- Add an Open "dialog" to the editor: a hidden frame with file browsing capabilities to load a form. Code taken from ide_methods.bas (QB64)
- Add a New option to File menu.
- Remove custom icon from the preview so that QB64's default icon is shown unless an icon file is specified.
- Detect if a control name matches QB64's keywords (not allowed).
This commit is contained in:
FellippeHeitor 2016-12-09 12:27:35 -02:00
parent 8a5b943f63
commit 514cfbd91d
6 changed files with 1365 additions and 839 deletions

758
InForm.ui

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,275 +6,342 @@ SUB __UI_LoadForm
DIM __UI_NewID AS LONG
__UI_NewID = __UI_NewControl(__UI_Type_Form, "UiEditorForm", 598, 430, 0, 0, 0)
__UI_SetCaption "UiEditorForm", UiEditorTitle$
Control(__UI_NewID).Font = __UI_Font("segoeui.ttf", 12, "")
SetCaption "UiEditorForm", UiEditorTitle$
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 12, "")
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "FileMenu", 44, 18, 8, 0, 0)
__UI_SetCaption "FileMenu", "&File"
SetCaption "FileMenu", "&File"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "ViewMenu", 44, 18, 52, 0, 0)
__UI_SetCaption "ViewMenu", "&View"
SetCaption "ViewMenu", "&View"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "InsertMenu", 44, 18, 52, 0, 0)
__UI_SetCaption "InsertMenu", "&Insert"
SetCaption "InsertMenu", "&Insert"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "AlignMenu", 0, 0, 0, 0, 0)
__UI_SetCaption "AlignMenu", "Align"
SetCaption "AlignMenu", "Align"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "OptionsMenu", 44, 18, 52, 0, 0)
__UI_SetCaption "OptionsMenu", "&Options"
SetCaption "OptionsMenu", "&Options"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "HelpMenu", 44, 18, 545, 0, 0)
__UI_SetCaption "HelpMenu", "&Help"
SetCaption "HelpMenu", "&Help"
Control(__UI_NewID).Align = __UI_Right
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "ToolBox", 62, 376, 30, 40, 0)
Control(__UI_NewID).HasBorder = __UI_True
Control(__UI_NewID).HasBorder = True
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "PropertiesFrame", 457, 186, 110, 40, 0)
__UI_SetCaption "PropertiesFrame", "Control properties: Main form"
Control(__UI_NewID).HasBorder = __UI_True
SetCaption "PropertiesFrame", "Control properties: Main form"
Control(__UI_NewID).HasBorder = True
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "ColorMixer", 457, 175, 110, 240, 0)
__UI_SetCaption "ColorMixer", "Color mixer"
Control(__UI_NewID).HasBorder = __UI_True
SetCaption "ColorMixer", "Color mixer"
Control(__UI_NewID).HasBorder = True
'__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuNew", 91, 18, 0, 22, __UI_GetID("FileMenu"))
'__UI_SetCaption "FileMenuNew", "&New"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuNew", 91, 18, 0, 22, __UI_GetID("FileMenu"))
SetCaption "FileMenuNew", "&New"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuOpen", 91, 18, 0, 22, __UI_GetID("FileMenu"))
SetCaption "FileMenuOpen", "&Open..."
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuSave", 91, 18, 0, 22, __UI_GetID("FileMenu"))
__UI_SetCaption "FileMenuSave", "&Save form-"
__UI_LoadImage Control(__UI_NewID), "InForm\disk.png"
SetCaption "FileMenuSave", "&Save form-"
ToolTip(__UI_NewID) = "File name is automatically taken from your form's name property"
LoadImage Control(__UI_NewID), "InForm\disk.png"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "FileMenuExit", 56, 18, 0, 40, __UI_GetID("FileMenu"))
__UI_SetCaption "FileMenuExit", "E&xit"
SetCaption "FileMenuExit", "E&xit"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuPreviewDetach", 56, 18, 0, 40, __UI_GetID("ViewMenu"))
__UI_SetCaption "ViewMenuPreviewDetach", "&Keep preview window attached"
SetCaption "ViewMenuPreviewDetach", "&Keep preview window attached"
Control(__UI_NewID).Value = -1
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuPreview", 56, 18, 0, 40, __UI_GetID("ViewMenu"))
__UI_SetCaption "ViewMenuPreview", "&Open preview window-"
SetCaption "ViewMenuPreview", "&Open preview window-"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuLoadedFonts", 56, 18, 0, 40, __UI_GetID("ViewMenu"))
__UI_SetCaption "ViewMenuLoadedFonts", "&Loaded fonts"
SetCaption "ViewMenuLoadedFonts", "&Loaded fonts"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "InsertMenuMenuBar", 0, 0, 0, 0, __UI_GetID("InsertMenu"))
__UI_SetCaption "InsertMenuMenuBar", "Menu &Bar"
SetCaption "InsertMenuMenuBar", "Menu &Bar"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "InsertMenuMenuItem", 0, 0, 0, 0, __UI_GetID("InsertMenu"))
__UI_SetCaption "InsertMenuMenuItem", "Menu &Item"
Control(__UI_NewID).Disabled = __UI_True
SetCaption "InsertMenuMenuItem", "Menu &Item"
Control(__UI_NewID).Disabled = True
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignLeft", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignLeft", "Align &Left"
SetCaption "AlignMenuAlignLeft", "Align &Left"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignRight", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignRight", "Align &Right"
SetCaption "AlignMenuAlignRight", "Align &Right"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignTops", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignTops", "Align T&op"
SetCaption "AlignMenuAlignTops", "Align T&op"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignBottoms", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignBottoms", "Align &Bottom-"
SetCaption "AlignMenuAlignBottoms", "Align &Bottom-"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignCentersV", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignCentersV", "Align cent&ers Vertically"
SetCaption "AlignMenuAlignCentersV", "Align cent&ers Vertically"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignCentersH", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignCentersH", "Ali&gn centers Horizontally"
SetCaption "AlignMenuAlignCentersH", "Ali&gn centers Horizontally"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignCenterV", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignCenterV", "Center &Vertically"
SetCaption "AlignMenuAlignCenterV", "Center &Vertically"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuAlignCenterH", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuAlignCenterH", "Center &Horizontally-"
SetCaption "AlignMenuAlignCenterH", "Center &Horizontally-"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuDistributeV", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuDistributeV", "Distribute Ver&tically"
SetCaption "AlignMenuDistributeV", "Distribute Ver&tically"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "AlignMenuDistributeH", 0, 0, 0, 0, __UI_GetID("AlignMenu"))
__UI_SetCaption "AlignMenuDistributeH", "Distribute Hori&zontally"
SetCaption "AlignMenuDistributeH", "Distribute Hori&zontally"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "OptionsMenuAutoName", 0, 0, 0, 0, __UI_GetID("OptionsMenu"))
__UI_SetCaption "OptionsMenuAutoName", "&Auto-name controls"
Control(__UI_NewID).Value = __UI_True
__UI_SetTip "OptionsMenuAutoName", "Automatically set control names based on caption and type"
SetCaption "OptionsMenuAutoName", "&Auto-name controls"
Control(__UI_NewID).Value = True
ToolTip(__UI_GetID("OptionsMenuAutoName")) = "Automatically set control names based on caption and type"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "HelpMenuHelp", 0, 0, 0, 0, __UI_GetID("HelpMenu"))
__UI_SetCaption "HelpMenuHelp", "&What's all this?"
SetCaption "HelpMenuHelp", "&What's all this?"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "HelpMenuAbout", 0, 0, 0, 0, __UI_GetID("HelpMenu"))
__UI_SetCaption "HelpMenuAbout", "&About..."
SetCaption "HelpMenuAbout", "&About..."
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddButton", 22, 22, 20, 26, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddLabel", 22, 22, 20, 56, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddTextBox", 22, 22, 20, 86, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddCheckBox", 22, 22, 20, 116, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddRadioButton", 22, 22, 20, 146, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddListBox", 22, 22, 20, 176, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddDropdownList", 22, 22, 20, 206, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddTrackBar", 22, 22, 20, 236, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddProgressBar", 22, 22, 20, 266, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddPictureBox", 22, 22, 20, 296, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "AddFrame", 22, 22, 20, 326, __UI_GetID("ToolBox"))
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "PropertiesList", 174, 23, 20, 20, __UI_GetID("PropertiesFrame"))
__UI_AddListBoxItem "PropertiesList", "Name"
__UI_AddListBoxItem "PropertiesList", "Caption"
__UI_AddListBoxItem "PropertiesList", "Text"
__UI_AddListBoxItem "PropertiesList", "Top"
__UI_AddListBoxItem "PropertiesList", "Left"
__UI_AddListBoxItem "PropertiesList", "Width"
__UI_AddListBoxItem "PropertiesList", "Height"
__UI_AddListBoxItem "PropertiesList", "Font"
__UI_AddListBoxItem "PropertiesList", "Tool tip"
__UI_AddListBoxItem "PropertiesList", "Value"
__UI_AddListBoxItem "PropertiesList", "Min"
__UI_AddListBoxItem "PropertiesList", "Max"
__UI_AddListBoxItem "PropertiesList", "Interval"
__UI_AddListBoxItem "PropertiesList", "Padding (Left/Right)"
Control(__UI_NewID).HasBorder = __UI_True
AddItem __UI_GetID("PropertiesList"), "Name"
AddItem __UI_GetID("PropertiesList"), "Caption"
AddItem __UI_GetID("PropertiesList"), "Text"
AddItem __UI_GetID("PropertiesList"), "Top"
AddItem __UI_GetID("PropertiesList"), "Left"
AddItem __UI_GetID("PropertiesList"), "Width"
AddItem __UI_GetID("PropertiesList"), "Height"
AddItem __UI_GetID("PropertiesList"), "Font"
AddItem __UI_GetID("PropertiesList"), "Tool tip"
AddItem __UI_GetID("PropertiesList"), "Value"
AddItem __UI_GetID("PropertiesList"), "Min"
AddItem __UI_GetID("PropertiesList"), "Max"
AddItem __UI_GetID("PropertiesList"), "Interval"
AddItem __UI_GetID("PropertiesList"), "Padding (Left/Right)"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).Value = 1
Control(__UI_NewID).Max = 14
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "PropertyValue", 250, 23, 200, 20, __UI_GetID("PropertiesFrame"))
Control(__UI_NewID).HasBorder = __UI_True
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "PropertyUpdateStatus", 16, 16, 430, 23, __UI_GetID("PropertiesFrame"))
Control(__UI_NewID).HasBorder = __UI_False
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).BackStyle = __UI_Transparent
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Stretch", 150, 17, 22, 59, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "Stretch", "Stretch"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "Stretch", "Stretch"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "HasBorder", 150, 17, 22, 79, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "HasBorder", "Has border"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "HasBorder", "Has border"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "ShowPercentage", 149, 17, 22, 99, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "ShowPercentage", "Show percentage"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "ShowPercentage", "Show percentage"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "WordWrap", 150, 17, 22, 119, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "WordWrap", "Word wrap"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "WordWrap", "Word wrap"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "CanHaveFocus", 150, 17, 182, 59, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "CanHaveFocus", "Can have focus"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "CanHaveFocus", "Can have focus"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Disabled", 150, 17, 182, 79, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "Disabled", "Disabled"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "Disabled", "Disabled"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Hidden", 150, 17, 182, 99, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "Hidden", "Hidden"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "Hidden", "Hidden"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "CenteredWindow", 150, 17, 182, 119, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "CenteredWindow", "Centered window"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "CenteredWindow", "Centered window"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "Resizable", 102, 17, 339, 59, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "Resizable", "Resizable"
Control(__UI_NewID).CanHaveFocus = __UI_True
SetCaption "Resizable", "Resizable"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Label1", 83, 20, 24, 151, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "Label1", "Text align:"
SetCaption "Label1", "Text align:"
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "AlignOptions", 104, 20, 109, 151, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "AlignOptions", "Left"
__UI_AddListBoxItem "AlignOptions", "Left"
__UI_AddListBoxItem "AlignOptions", "Center"
__UI_AddListBoxItem "AlignOptions", "Right"
Control(__UI_NewID).HasBorder = __UI_True
SetCaption "AlignOptions", "Left"
AddItem __UI_GetID("AlignOptions"), "Left"
AddItem __UI_GetID("AlignOptions"), "Center"
AddItem __UI_GetID("AlignOptions"), "Right"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).Value = 1
Control(__UI_NewID).Max = 3
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Label2", 83, 20, 225, 151, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "Label2", "Back style:"
SetCaption "Label2", "Back style:"
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "BackStyleOptions", 134, 20, 311, 151, __UI_GetID("PropertiesFrame"))
__UI_SetCaption "BackStyleOptions", "Left"
__UI_AddListBoxItem "BackStyleOptions", "Opaque"
__UI_AddListBoxItem "BackStyleOptions", "Transparent"
Control(__UI_NewID).HasBorder = __UI_True
SetCaption "BackStyleOptions", "Left"
AddItem __UI_GetID("BackStyleOptions"), "Opaque"
AddItem __UI_GetID("BackStyleOptions"), "Transparent"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).Value = 1
Control(__UI_NewID).Max = 2
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_DropdownList, "ColorPropertiesList", 161, 21, 10, 20, __UI_GetID("ColorMixer"))
__UI_AddListBoxItem "ColorPropertiesList", "ForeColor"
__UI_AddListBoxItem "ColorPropertiesList", "BackColor"
__UI_AddListBoxItem "ColorPropertiesList", "SelectedForeColor"
__UI_AddListBoxItem "ColorPropertiesList", "SelectedBackColor"
__UI_AddListBoxItem "ColorPropertiesList", "BorderColor"
Control(__UI_NewID).HasBorder = __UI_True
AddItem __UI_GetID("ColorPropertiesList"), "ForeColor"
AddItem __UI_GetID("ColorPropertiesList"), "BackColor"
AddItem __UI_GetID("ColorPropertiesList"), "SelectedForeColor"
AddItem __UI_GetID("ColorPropertiesList"), "SelectedBackColor"
AddItem __UI_GetID("ColorPropertiesList"), "BorderColor"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).Value = 1
Control(__UI_NewID).Max = 5
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "ColorPreview", 159, 115, 10, 51, __UI_GetID("ColorMixer"))
Control(__UI_NewID).HasBorder = __UI_True
Control(__UI_NewID).HasBorder = True
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "Red", 198, 40, 191, 17, __UI_GetID("ColorMixer"))
Control(__UI_NewID).Max = 255
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
Control(__UI_NewID).Interval = 25
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "RedValue", 36, 23, 400, 20, __UI_GetID("ColorMixer"))
Control(__UI_NewID).BorderColor = _RGB32(255, 0, 0)
Control(__UI_NewID).HasBorder = __UI_True
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "Green", 198, 40, 191, 67, __UI_GetID("ColorMixer"))
Control(__UI_NewID).Max = 255
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
Control(__UI_NewID).Interval = 25
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "GreenValue", 36, 23, 400, 70, __UI_GetID("ColorMixer"))
Control(__UI_NewID).BorderColor = _RGB32(0, 180, 0)
Control(__UI_NewID).HasBorder = __UI_True
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_TrackBar, "Blue", 198, 40, 191, 117, __UI_GetID("ColorMixer"))
Control(__UI_NewID).Max = 255
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).CanHaveFocus = True
Control(__UI_NewID).Interval = 25
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "BlueValue", 36, 23, 400, 120, __UI_GetID("ColorMixer"))
Control(__UI_NewID).BorderColor = _RGB32(0, 0, 255)
Control(__UI_NewID).HasBorder = __UI_True
Control(__UI_NewID).CanHaveFocus = __UI_True
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
'----------------------------------
'Open dialog:
'----------------------------------
__UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "DialogBG", 598, 430, -600, -500, 0)
Control(__UI_NewID).BackColor = _RGB32(200, 200, 200)
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "OpenFrame", 463, 289, -600, -500, 0)
SetCaption "OpenFrame", "Open"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).BackColor = _RGB32(200, 200, 200)
__UI_NewID = __UI_NewControl(__UI_Type_Label, "FileNameLB", 73, 23, 15, 16, __UI_GetID("OpenFrame"))
SetCaption "FileNameLB", "File &name:"
Control(__UI_NewID).BackStyle = __UI_Transparent
__UI_NewID = __UI_NewControl(__UI_Type_TextBox, "FileNameTextBox", 363, 23, 89, 16, __UI_GetID("OpenFrame"))
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Label, "PathLB", 437, 23, 15, 44, __UI_GetID("OpenFrame"))
SetCaption "PathLB", "Path: C:\QB64"
Control(__UI_NewID).BackStyle = __UI_Transparent
__UI_NewID = __UI_NewControl(__UI_Type_Label, "FilesLB", 200, 23, 25, 75, __UI_GetID("OpenFrame"))
SetCaption "FilesLB", "&Files:"
Control(__UI_NewID).BackStyle = __UI_Transparent
__UI_NewID = __UI_NewControl(__UI_Type_ListBox, "FileList", 200, 150, 25, 99, __UI_GetID("OpenFrame"))
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Label, "PathsLB", 200, 23, 242, 75, __UI_GetID("OpenFrame"))
SetCaption "PathsLB", "&Paths:"
Control(__UI_NewID).BackStyle = __UI_Transparent
__UI_NewID = __UI_NewControl(__UI_Type_ListBox, "DirList", 200, 150, 242, 99, __UI_GetID("OpenFrame"))
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "OpenBT", 80, 23, 274, 255, __UI_GetID("OpenFrame"))
SetCaption "OpenBT", "&Open"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "CancelBT", 80, 23, 362, 255, __UI_GetID("OpenFrame"))
SetCaption "CancelBT", "&Cancel"
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "ShowOnlyFrmbinFilesCB", 200, 23, 25, 255, __UI_GetID("OpenFrame"))
SetCaption "ShowOnlyFrmbinFilesCB", "Show only .frmbin files"
Control(__UI_NewID).Value = -1
Control(__UI_NewID).CanHaveFocus = True
Control(__UI_NewID).BackStyle = __UI_Transparent
END SUB
SUB __UI_AssignIDs
DialogBG = __UI_GetID("DialogBG")
OpenFrame = __UI_GetID("OpenFrame")
FileNameLB = __UI_GetID("FileNameLB")
FileNameTextBox = __UI_GetID("FileNameTextBox")
PathLB = __UI_GetID("PathLB")
FilesLB = __UI_GetID("FilesLB")
FileList = __UI_GetID("FileList")
PathsLB = __UI_GetID("PathsLB")
DirList = __UI_GetID("DirList")
OpenBT = __UI_GetID("OpenBT")
CancelBT = __UI_GetID("CancelBT")
ShowOnlyFrmbinFilesCB = __UI_GetID("ShowOnlyFrmbinFilesCB")
END SUB

View file

@ -1,6 +1,6 @@
OPTION _EXPLICIT
$EXEICON:'.\InForm\InForm Preview.ico'
'$EXEICON:'.\InForm\InForm Preview.ico'
CONST OffsetEditorPID = 1
CONST OffsetPreviewPID = 5
@ -21,6 +21,9 @@ DIM SHARED UiPreviewPID AS LONG
DIM SHARED ExeIcon AS LONG
DIM SHARED AutoNameControls AS _BYTE
REDIM SHARED QB64KEYWORDS(0) AS STRING
READ_KEYWORDS
DIM i AS LONG
DIM SHARED AlphaNumeric(255)
FOR i = 48 TO 57: AlphaNumeric(i) = -1: NEXT
@ -97,7 +100,7 @@ SUB __UI_BeforeUpdateDisplay
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
IF NOT MidRead THEN
MidRead = __UI_True
MidRead = True
b$ = SPACE$(4): GET #UiEditorFile, OffsetEditorPID, b$
UiEditorPID = CVL(b$)
@ -122,14 +125,14 @@ SUB __UI_BeforeUpdateDisplay
b& = GetExitCodeProcess(hnd&, ExitCode&)
IF b& = 1 AND ExitCode& = 259 THEN
'Editor is active.
EditorWasActive = __UI_True
EditorWasActive = True
ELSE
'Editor was closed.
IF EditorWasActive = __UI_False THEN
IF EditorWasActive = False THEN
'Preview was launched by user
DIM Answer AS LONG
_SCREENHIDE
Answer = __UI_MessageBox("InForm Designer is not running. Please run the main program.", "InForm Preview", 0)
Answer = MessageBox("InForm Designer is not running. Please run the main program.", "InForm Preview", 0)
END IF
SYSTEM
END IF
@ -161,13 +164,13 @@ SUB __UI_BeforeUpdateDisplay
TempValue = __UI_NewControl(__UI_Type_Button, "", 80, 23, TempWidth \ 2 - 40, TempHeight \ 2 - 12, ThisContainer)
CASE __UI_Type_Label, __UI_Type_CheckBox, __UI_Type_RadioButton
TempValue = __UI_NewControl(TempValue, "", 150, 23, TempWidth \ 2 - 75, TempHeight \ 2 - 12, ThisContainer)
__UI_SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
CASE __UI_Type_TextBox
TempValue = __UI_NewControl(__UI_Type_TextBox, "", 120, 23, TempWidth \ 2 - 60, TempHeight \ 2 - 12, ThisContainer)
__UI_SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
CASE __UI_Type_ListBox
TempValue = __UI_NewControl(__UI_Type_ListBox, "", 200, 200, TempWidth \ 2 - 100, TempHeight \ 2 - 100, ThisContainer)
Control(TempValue).HasBorder = __UI_True
Control(TempValue).HasBorder = True
CASE __UI_Type_DropdownList
TempValue = __UI_NewControl(__UI_Type_DropdownList, "", 200, 23, TempWidth \ 2 - 100, TempHeight \ 2 - 12, ThisContainer)
CASE __UI_Type_TrackBar
@ -178,7 +181,7 @@ SUB __UI_BeforeUpdateDisplay
TempValue = __UI_NewControl(TempValue, "", 230, 150, TempWidth \ 2 - 115, TempHeight \ 2 - 75, ThisContainer)
CASE __UI_Type_Frame
TempValue = __UI_NewControl(TempValue, "", 230, 150, TempWidth \ 2 - 115, TempHeight \ 2 - 75, 0)
__UI_SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
CASE __UI_Type_MenuBar
'Before adding a menu bar item, reset all other menu bar items' alignment
FOR i = 1 TO UBOUND(Control)
@ -187,32 +190,38 @@ SUB __UI_BeforeUpdateDisplay
END IF
NEXT
TempValue = __UI_NewControl(TempValue, "", 0, 0, 0, 0, 0)
__UI_SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
__UI_RefreshMenuBar
__UI_ActivateMenu Control(TempValue), __UI_False
__UI_ActivateMenu Control(TempValue), False
CASE __UI_Type_MenuItem
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) <> "__UI_" THEN
TempValue = __UI_NewControl(TempValue, "", 0, 0, 0, 0, __UI_ParentMenu)
__UI_SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
__UI_ActivateMenu Control(__UI_ParentMenu), __UI_False
SetCaption Control(TempValue).Name, RTRIM$(Control(TempValue).Name)
__UI_ActivateMenu Control(__UI_ParentMenu), False
END IF
END SELECT
IF __UI_ActiveMenu > 0 AND (Control(TempValue).Type <> __UI_Type_MenuBar AND Control(TempValue).Type <> __UI_Type_MenuItem) THEN
__UI_DestroyControl Control(__UI_ActiveMenu)
END IF
FOR i = 1 TO UBOUND(Control)
Control(i).ControlIsSelected = __UI_False
Control(i).ControlIsSelected = False
NEXT
Control(TempValue).ControlIsSelected = __UI_True
Control(TempValue).ControlIsSelected = True
__UI_TotalSelectedControls = 1
__UI_FirstSelectedID = TempValue
__UI_ForceRedraw = __UI_True
__UI_ForceRedraw = True
END IF
b$ = SPACE$(2): GET #UiEditorFile, OffsetNewDataFromEditor, b$
TempValue = CVI(b$)
b$ = MKI$(0): PUT #UiEditorFile, OffsetNewDataFromEditor, b$
IF TempValue = -1 THEN
IF TempValue = -2 THEN
'Hide the preview
_SCREENHIDE
ELSEIF TempValue = -3 THEN
'Show the preview
_SCREENSHOW
ELSEIF TempValue = -1 THEN
DIM FloatValue AS _FLOAT
'Editor sent property value
b$ = SPACE$(2): GET #UiEditorFile, OffsetPropertyChanged, b$
@ -238,10 +247,10 @@ SUB __UI_BeforeUpdateDisplay
IF __UI_TotalSelectedControls > 0 THEN
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
__UI_SetCaption RTRIM$(Control(i).Name), b$
SetCaption RTRIM$(Control(i).Name), b$
IF LEN(b$) > 0 AND b$ <> "&" THEN GOSUB AutoName
IF Control(i).Type = __UI_Type_MenuItem THEN
__UI_ActivateMenu Control(Control(i).ParentID), __UI_False
__UI_ActivateMenu Control(Control(i).ParentID), False
END IF
END IF
NEXT
@ -291,15 +300,16 @@ SUB __UI_BeforeUpdateDisplay
IF Control(i).ControlIsSelected THEN
Text(i) = b$
IF Control(i).Type = __UI_Type_Button OR Control(i).Type = __UI_Type_MenuItem THEN
__UI_LoadImage Control(i), b$
LoadImage Control(i), b$
ELSEIF Control(i).Type = __UI_Type_PictureBox THEN
__UI_LoadImage Control(i), b$
LoadImage Control(i), b$
IF LEN(Text(i)) > 0 THEN 'Load successful
'Keep aspect ratio at load
Control(i).Height = (_HEIGHT(Control(i).HelperCanvas) / _WIDTH(Control(i).HelperCanvas)) * Control(i).Width
END IF
IF LEN(b$) > 0 AND b$ <> "&" THEN GOSUB AutoName
ELSEIF Control(i).Type = __UI_Type_ListBox OR Control(i).Type = __UI_Type_DropdownList THEN
Text(i) = __UI_ReplaceText(b$, "\n", CHR$(13), __UI_False, TotalReplacements)
Text(i) = Replace(b$, "\n", CHR$(13), False, TotalReplacements)
IF Control(i).Max < TotalReplacements + 1 THEN Control(i).Max = TotalReplacements + 1
Control(i).LastVisibleItem = 0 'Reset it so it's recalculated
END IF
@ -384,16 +394,16 @@ SUB __UI_BeforeUpdateDisplay
IF __UI_TotalSelectedControls > 0 THEN
FOR i = 1 TO UBOUND(Control)
IF Control(i).ControlIsSelected THEN
Control(i).Font = __UI_Font(NewFontFile, NewFontSize, NewFontParameters)
Control(i).Font = SetFont(NewFontFile, NewFontSize, NewFontParameters)
END IF
NEXT
ELSE
Control(__UI_FormID).Font = __UI_Font(NewFontFile, NewFontSize, NewFontParameters)
Control(__UI_FormID).Font = SetFont(NewFontFile, NewFontSize, NewFontParameters)
DIM MustRedrawMenus AS _BYTE
FOR i = 1 TO UBOUND(Control)
IF Control(i).Type = __UI_Type_MenuBar OR Control(i).Type = __UI_Type_MenuItem OR Control(i).Type = __UI_Type_MenuPanel OR Control(i).Type = __UI_Type_ContextMenu THEN
Control(i).Font = __UI_Font(NewFontFile, NewFontSize, NewFontParameters)
MustRedrawMenus = __UI_True
Control(i).Font = SetFont(NewFontFile, NewFontSize, NewFontParameters)
MustRedrawMenus = True
END IF
NEXT
IF MustRedrawMenus THEN __UI_RefreshMenuBar
@ -483,7 +493,7 @@ SUB __UI_BeforeUpdateDisplay
IF Control(i).ControlIsSelected THEN
Control(i).Hidden = CVI(b$)
IF Control(i).Type = __UI_Type_MenuItem AND __UI_ParentMenu = Control(i).ParentID THEN
__UI_ActivateMenu Control(Control(i).ParentID), __UI_False
__UI_ActivateMenu Control(Control(i).ParentID), False
END IF
END IF
NEXT
@ -606,9 +616,9 @@ SUB __UI_BeforeUpdateDisplay
CASE 201 TO 210
'Alignment commands
__UI_DesignModeAlignCommand = TempValue
__UI_HasInput = __UI_True
__UI_HasInput = True
END SELECT
__UI_ForceRedraw = __UI_True
__UI_ForceRedraw = True
END IF
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) = "__UI_" AND __UI_CantShowContextMenu THEN
@ -625,23 +635,23 @@ SUB __UI_BeforeUpdateDisplay
b$ = MKL$(__UI_FormID)
PUT #UiEditorFile, OffsetFormID, b$
MidRead = __UI_False
MidRead = False
CLOSE #UiEditorFile
END IF
END SUB
SUB __UI_BeforeUnload
'DIM Answer AS _BYTE
'Answer = __UI_MessageBox("Leaving UI", "Copy current form data to clipboard?", __UI_MsgBox_YesNoCancel + __UI_MsgBox_Question)
'IF Answer = __UI_MsgBox_Cancel THEN
' __UI_UnloadSignal = __UI_False
'ELSEIF Answer = __UI_MsgBox_Yes THEN
' Answer = __UI_MessageBox("Leaving UI", "Not yet implemented", __UI_MsgBox_OkOnly + __UI_MsgBox_Information)
'Answer = MessageBox("Leaving UI", "Copy current form data to clipboard?", MsgBox_YesNoCancel + MsgBox_Question)
'IF Answer = MsgBox_Cancel THEN
' __UI_UnloadSignal = False
'ELSEIF Answer = MsgBox_Yes THEN
' Answer = MessageBox("Leaving UI", "Not yet implemented", MsgBox_OkOnly + MsgBox_Information)
'END IF
END SUB
SUB __UI_BeforeInit
__UI_DesignMode = __UI_True
__UI_DesignMode = True
UiPreviewPID = __UI_GetPID
LoadPreview
END SUB
@ -666,7 +676,7 @@ SUB LoadPreview
DIM Dummy AS LONG
DIM BinaryFileNum AS INTEGER, LogFileNum AS INTEGER
CONST LogFileLoad = __UI_False
CONST LogFileLoad = False
IF _FILEEXISTS("UiEditorPreview.frmbin") = 0 THEN
EXIT SUB
@ -682,9 +692,9 @@ SUB LoadPreview
EXIT SUB
END IF
IF LogFileLoad THEN PRINT #LogFileNum, "FOUND INFORM+1"
__UI_AutoRefresh = __UI_False
__UI_AutoRefresh = False
FOR i = UBOUND(Control) TO 1 STEP -1
IF LEFT$(Control(i).Name, 9) <> "__UI_Text" AND LEFT$(Control(i).Name, 16) <> "__UI_PreviewMenu" THEN
IF LEFT$(Control(i).Name, 5) <> "__UI_" THEN
__UI_DestroyControl Control(i)
END IF
NEXT
@ -744,7 +754,7 @@ SUB LoadPreview
b$ = SPACE$(4): GET #BinaryFileNum, , b$
b$ = SPACE$(CVL(b$))
GET #BinaryFileNum, , b$
__UI_SetCaption RTRIM$(Control(TempValue).Name), b$
SetCaption RTRIM$(Control(TempValue).Name), b$
IF LogFileLoad THEN PRINT #LogFileNum, "CAPTION:" + Caption(TempValue)
CASE -3 'Text
b$ = SPACE$(4): GET #BinaryFileNum, , b$
@ -752,7 +762,7 @@ SUB LoadPreview
GET #BinaryFileNum, , b$
Text(TempValue) = b$
IF Control(TempValue).Type = __UI_Type_PictureBox OR Control(TempValue).Type = __UI_Type_Button THEN
__UI_LoadImage Control(TempValue), Text(TempValue)
LoadImage Control(TempValue), Text(TempValue)
ELSEIF Control(TempValue).Type = __UI_Type_Form THEN
IF ExeIcon <> 0 THEN _FREEIMAGE ExeIcon: ExeIcon = 0
ExeIcon = IconPreview&(b$)
@ -762,7 +772,7 @@ SUB LoadPreview
END IF
IF LogFileLoad THEN PRINT #LogFileNum, "TEXT:" + Text(TempValue)
CASE -4 'Stretch
Control(TempValue).Stretch = __UI_True
Control(TempValue).Stretch = True
IF LogFileLoad THEN PRINT #LogFileNum, "STRETCH"
CASE -5 'Font
IF LogFileLoad THEN PRINT #LogFileNum, "FONT:";
@ -781,7 +791,7 @@ SUB LoadPreview
NewFontSize = VAL(FontSetup$)
Control(TempValue).Font = __UI_Font(NewFontFile, NewFontSize, NewFontAttributes)
Control(TempValue).Font = SetFont(NewFontFile, NewFontSize, NewFontAttributes)
CASE -6 'ForeColor
b$ = SPACE$(4): GET #BinaryFileNum, , b$
Control(TempValue).ForeColor = _CV(_UNSIGNED LONG, b$)
@ -806,7 +816,7 @@ SUB LoadPreview
Control(TempValue).BackStyle = __UI_Transparent
IF LogFileLoad THEN PRINT #LogFileNum, "BACKSTYLE:TRANSPARENT"
CASE -12
Control(TempValue).HasBorder = __UI_True
Control(TempValue).HasBorder = True
IF LogFileLoad THEN PRINT #LogFileNum, "HASBORDER"
CASE -13
b$ = SPACE$(1): GET #BinaryFileNum, , b$
@ -833,19 +843,19 @@ SUB LoadPreview
Control(TempValue).HotKeyOffset = CVI(b$)
IF LogFileLoad THEN PRINT #LogFileNum, "HOTKEYOFFSET="; Control(TempValue).HotKeyOffset
CASE -19
Control(TempValue).ShowPercentage = __UI_True
Control(TempValue).ShowPercentage = True
IF LogFileLoad THEN PRINT #LogFileNum, "SHOWPERCENTAGE"
CASE -20
Control(TempValue).CanHaveFocus = __UI_True
Control(TempValue).CanHaveFocus = True
IF LogFileLoad THEN PRINT #LogFileNum, "CANHAVEFOCUS"
CASE -21
Control(TempValue).Disabled = __UI_True
Control(TempValue).Disabled = True
IF LogFileLoad THEN PRINT #LogFileNum, "DISABLED"
CASE -22
Control(TempValue).Hidden = __UI_True
Control(TempValue).Hidden = True
IF LogFileLoad THEN PRINT #LogFileNum, "HIDDEN"
CASE -23
Control(TempValue).CenteredWindow = __UI_True
Control(TempValue).CenteredWindow = True
IF LogFileLoad THEN PRINT #LogFileNum, "CENTEREDWINDOW"
CASE -24 'Tips
b$ = SPACE$(4): GET #BinaryFileNum, , b$
@ -864,7 +874,7 @@ SUB LoadPreview
Control(TempValue).Interval = _CV(_FLOAT, b$)
IF LogFileLoad THEN PRINT #LogFileNum, "INTERVAL="; Control(TempValue).Interval
CASE -27
Control(TempValue).WordWrap = __UI_True
Control(TempValue).WordWrap = True
IF LogFileLoad THEN PRINT #LogFileNum, "WORDWRAP"
CASE -28
b$ = SPACE$(4): GET #BinaryFileNum, , b$
@ -872,7 +882,7 @@ SUB LoadPreview
IF LogFileLoad THEN PRINT #LogFileNum, "TRANSPARENTCOLOR"
__UI_ClearColor Control(TempValue).HelperCanvas, Control(TempValue).TransparentColor, -1
CASE -29
Control(TempValue).CanResize = __UI_True
Control(TempValue).CanResize = True
IF LogFileLoad THEN PRINT #LogFileNum, "CANRESIZE"
CASE -31
b$ = SPACE$(2): GET #BinaryFileNum, , b$
@ -883,7 +893,7 @@ SUB LoadPreview
EXIT DO
CASE -1024
IF LogFileLoad THEN PRINT #LogFileNum, "READ END OF FILE: -1024"
__UI_EOF = __UI_True
__UI_EOF = True
EXIT DO
CASE ELSE
IF LogFileLoad THEN PRINT #LogFileNum, "UNKNOWN PROPERTY ="; CVI(b$)
@ -893,12 +903,13 @@ SUB LoadPreview
LOOP UNTIL __UI_EOF
CLOSE #BinaryFileNum
IF LogFileLoad THEN CLOSE #LogFileNum
__UI_AutoRefresh = __UI_True
__UI_AutoRefresh = True
EXIT SUB
LoadError:
__UI_AutoRefresh = __UI_True
CLOSE #BinaryFileNum
KILL "UiEditorPreview.frmbin"
__UI_AutoRefresh = True
EXIT SUB
END IF
END SUB
@ -907,7 +918,7 @@ SUB SavePreview
DIM b$, i AS LONG, a$, FontSetup$, TempValue AS LONG
DIM BinFileNum AS INTEGER, TxtFileNum AS INTEGER
CONST Debug = __UI_False
CONST Debug = False
BinFileNum = FREEFILE
OPEN "UiEditorPreview.frmbin" FOR BINARY AS #BinFileNum
@ -1200,18 +1211,25 @@ FUNCTION AdaptName$ (tName$, TargetID AS LONG)
DIM Name$, NewName$, i AS LONG, c$, NextIsCapital AS _BYTE, CheckID AS LONG
Name$ = RTRIM$(tName$)
IF NOT AlphaNumeric(ASC(Name$, 1)) AND ASC(Name$, 1) <> 38 THEN Name$ = "__" + Name$
DO
IF Alpha(ASC(Name$, 1)) OR ASC(Name$, 1) = 38 THEN
IF LEFT$(Name$, 1) = "_" AND MID$(Name$, 2, 1) <> "_" THEN Name$ = "_" + Name$
EXIT DO
END IF
Name$ = MID$(Name$, 2)
IF LEN(Name$) = 0 THEN Name$ = Control(TargetID).Name: EXIT DO
LOOP
FOR i = 1 TO LEN(Name$)
IF AlphaNumeric(ASC(Name$, i)) THEN
IF NextIsCapital THEN
NewName$ = NewName$ + UCASE$(CHR$(ASC(Name$, i)))
IF ASC(RIGHT$(NewName$, 1)) >= 65 AND ASC(RIGHT$(NewName$, 1)) <= 90 THEN NextIsCapital = __UI_False
IF ASC(RIGHT$(NewName$, 1)) >= 65 AND ASC(RIGHT$(NewName$, 1)) <= 90 THEN NextIsCapital = False
ELSE
NewName$ = NewName$ + CHR$(ASC(Name$, i))
END IF
ELSE
IF ASC(Name$, i) = 32 THEN NextIsCapital = __UI_True
IF ASC(Name$, i) = 32 THEN NextIsCapital = True
END IF
NEXT
@ -1233,5 +1251,84 @@ FUNCTION AdaptName$ (tName$, TargetID AS LONG)
END IF
LOOP
IF IS_KEYWORD(NewName$) THEN NewName$ = "__" + NewName$
AdaptName$ = NewName$
END FUNCTION
'READ_KEYWORDS and IS_KEYWORD come from vWATCH64:
SUB READ_KEYWORDS
DIM ThisKeyword$, TotalKeywords AS INTEGER
RESTORE QB64KeywordsDATA
'Populate QB64KEYWORDS():
DO
READ ThisKeyword$
IF ThisKeyword$ = "**END**" THEN
EXIT DO
END IF
TotalKeywords = TotalKeywords + 1
REDIM _PRESERVE QB64KEYWORDS(1 TO TotalKeywords) AS STRING
QB64KEYWORDS(TotalKeywords) = ThisKeyword$
LOOP
QB64KeywordsDATA:
DATA $IF,$ELSE,$END
DATA _ALPHA,_ALPHA32,_AUTODISPLAY,_AXIS,_BACKGROUNDCOLOR,_BIT,
DATA _BLEND,_BLUE,_BLUE32,_BUTTON,_BUTTONCHANGE,_BYTE,$CHECKING
DATA _CLEARCOLOR,_CLIP,_CLIPBOARD$,_CONNECTED,_CONNECTIONADDRESS$
DATA $CONSOLE,_CONSOLE,_CONSOLETITLE,_CONTROLCHR,_COPYIMAGE,_COPYPALETTE
DATA _CV,_DEFAULTCOLOR,_DEFINE,_DELAY,_DEST,_DEST,_DEVICE$,_DEVICEINPUT
DATA _DEVICES,_DIREXISTS,_DISPLAY,_DISPLAY,_DONTBLEND,_DONTWAIT
DATA _ERRORLINE,_EXIT,_FILEEXISTS,_FLOAT,_FONT,_FONT,_FONTHEIGHT
DATA _FONTWIDTH,_FREEFONT,_FREEIMAGE,_FREETIMER,_FULLSCREEN,_FULLSCREEN
DATA _GREEN,_GREEN32,_HEIGHT,_HIDE,_ICON,_INTEGER64,_KEYHIT,_KEYDOWN
DATA _LASTAXIS,_LASTBUTTON,_LASTWHEEL,_LIMIT,_LOADFONT,_LOADIMAGE
DATA _MAPTRIANGLE,_MAPUNICODE,_MEM,_MEMCOPY,_MEMELEMENT,_MEMFILL
DATA _MEMFREE,_MEMGET,_MEMIMAGE,_MEMNEW,_MEMPUT,_MIDDLE,_MK$,_MOUSEBUTTON
DATA _MOUSEHIDE,_MOUSEINPUT,_MOUSEMOVE,_MOUSEMOVEMENTX,_MOUSEMOVEMENTY
DATA _MOUSESHOW,_MOUSEWHEEL,_MOUSEX,_MOUSEY,_NEWIMAGE,_NONE,_OFFSET
DATA _OPENCLIENT,_OPENCONNECTION,_OPENHOST,_OS$,_PALETTECOLOR,_PIXELSIZE
DATA _PRESERVE,_PRINTIMAGE,_PRINTMODE,_PRINTSTRING,_PRINTWIDTH,_PUTIMAGE
DATA _RED,_RED32,$RESIZE,_RESIZE,_RGB,_RGB32,_RGBA,_RGBA32
DATA _ROUND,_SCREENCLICK,$SCREENHIDE,_SCREENHIDE,_SCREENIMAGE,_SCREENMOVE
DATA _SCREENPRINT,$SCREENSHOW,_SCREENSHOW,_SCREENX,_SCREENY,_SETALPHA
DATA _SHELLHIDE,_SNDBAL,_SNDCLOSE,_SNDCOPY,_SNDGETPOS,_SNDLEN,_SNDLIMIT
DATA _SNDLOOP,_SNDOPEN,_SNDPAUSE,_SNDPAUSED,_SNDPLAY,_SNDPLAYCOPY
DATA _SNDPLAYFILE,_SNDPLAYING,_SNDRATE,_SNDRAW,_SNDRAWLEN,_SNDRAWDONE
DATA _SNDRAWOPEN,_SNDSETPOS,_SNDSTOP,_SNDVOL,_SOURCE,_TITLE,_UNSIGNED
DATA _WHEEL,_WIDTH,ABS,ABSOLUTE,ACCESS,ALIAS,AND,ANY,APPEND
DATA AS,ASC,ATN,BEEP,BINARY,BLOAD,BSAVE,BYVAL,CALL,CALLS
DATA CASE,CDBL,CDECL,CHAIN,CHDIR,CHR$,CINT,CIRCLE,CLEAR,CLNG
DATA CLOSE,CLS,COLOR,COMMAND$,COMMON,CONST,COS,CSNG,CSRLIN
DATA CVD,CVDMBF,CVI,CVL,CVS,CVSMBF,DATA,DATE$,DECLARE,DEF
DATA DEFDBL,DEFINT,DEFLNG,DEFSNG,DEFSTR,DIM,DO,DOUBLE,DRAW
DATA $DYNAMIC,ELSE,ELSEIF,END,ENVIRON,EOF,EQV,ERASE,ERDEV
DATA ERL,ERR,ERROR,EXIT,EXP,FIELD,FILEATTR,FILES,FIX,FOR
DATA FRE,FREE,FREEFILE,FUNCTION,GET,GOSUB,GOTO,HEX$,IF,IMP
DATA $INCLUDE,INKEY$,INP,INPUT,INSTR,INT,INTEGER,INTERRUPT
DATA INTERRUPTX,IOCTL,IOCTL$,IS,KEY,KILL,LBOUND,LCASE$,LEFT$,LEN
DATA LET,LINE,LIST,LOC,LOCATE,LOCK,LOF,LOG,LONG,LOOP,LPOS
DATA LPRINT,LSET,LTRIM$,MID,MID$,MKD$,MKDIR,MKDMBF$,MKI$,MKL$
DATA MKS$,MKSMBF$,MOD,NAME,NEXT,NOT,OCT$,OFF,ON,OPEN,OPTION
DATA OR,OUT,OUTPUT,PAINT,PALETTE,PCOPY,PEEK,PEN,PLAY,PMAP
DATA POINT,POKE,POS,PRESET,PRINT,PSET,PUT,RANDOM,RANDOMIZE
DATA READ,REDIM,REM,RESET,RESTORE,RESUME,RETURN,RIGHT$,RMDIR
DATA RND,RSET,RTRIM$,RUN,SADD,SCREEN,SEEK,SEG,SELECT,SETMEM,SGN
DATA SHARED,SHELL,SIGNAL,SIN,SINGLE,SLEEP,SOUND,SPACE$,SPC
DATA SQR,STATIC,$STATIC,STEP,STICK,STOP,STR$,STRIG,STRING
DATA STRING$,SUB,SWAP,SYSTEM,TAB,TAN,THEN,TIME$,TIMER,TO
DATA TROFF,TRON,TYPE,UBOUND,UCASE$,UEVENT,UNLOCK,UNTIL,VAL
DATA VARPTR,VARPTR$,VARSEG,VIEW,WAIT,WEND,WHILE,WIDTH,WINDOW
DATA WRITE,XOR,_CEIL,BASE,_EXPLICIT,_INCLERRORLINE,_DIR$
DATA _INCLERRORFILE$,$EXEICON,**END**
END SUB
FUNCTION IS_KEYWORD (Text$)
DIM uText$, i AS INTEGER
uText$ = UCASE$(RTRIM$(LTRIM$(Text$)))
FOR i = 1 TO UBOUND(QB64KEYWORDS)
IF QB64KEYWORDS(i) = uText$ THEN IS_KEYWORD = True: EXIT FUNCTION
NEXT i
END FUNCTION

View file

@ -8,7 +8,7 @@ SUB __UI_LoadForm
_RESIZE OFF
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Form1", 300, 300, 0, 0,0)
Control(__UI_NewID).Font = __UI_Font("segoeui.ttf", 12, "")
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 12, "")
END SUB
SUB __UI_AssignIDs

View file

@ -74,7 +74,7 @@ SUB __UI_DrawButton (This AS __UI_ControlTYPE, ControlState AS _BYTE)
This.FocusState = __UI_Focus = This.ID
__UI_TempCaptions(This.ID) = Caption(This.ID)
This.PreviousParentID = This.ParentID
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
IF This.Canvas <> 0 THEN
_FREEIMAGE This.Canvas
@ -127,7 +127,7 @@ SUB __UI_DrawButton (This AS __UI_ControlTYPE, ControlState AS _BYTE)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
Temp& = uprint((IconWidth / 2) + (This.Width \ 2 - __UI_PrintWidth&(TempCaption$) \ 2), ((This.Height \ 2) - uheight& \ 2), TempCaption$, LEN(TempCaption$), TempColor~&, 0)
@ -157,7 +157,7 @@ SUB __UI_DrawLabel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
'Last time this control was drawn it had a different state/caption, so it'll be redrawn
This.ControlState = ControlState
__UI_TempCaptions(This.ID) = Caption(This.ID)
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -181,7 +181,7 @@ SUB __UI_DrawLabel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
'Caption:
@ -286,7 +286,7 @@ SUB __UI_DrawRadioButton (This AS __UI_ControlTYPE, ControlState AS _BYTE)
This.FocusState = __UI_Focus = This.ID
This.PreviousValue = This.Value
__UI_TempCaptions(This.ID) = Caption(This.ID)
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -309,7 +309,7 @@ SUB __UI_DrawRadioButton (This AS __UI_ControlTYPE, ControlState AS _BYTE)
DIM i AS SINGLE
CaptionIndent = 0
IF This.HasBorder = __UI_True THEN
IF This.HasBorder = True THEN
CaptionIndent = 5
LINE (0, 0)-STEP(This.Width - 1, This.Height - 1), This.BorderColor, B
END IF
@ -323,7 +323,7 @@ SUB __UI_DrawRadioButton (This AS __UI_ControlTYPE, ControlState AS _BYTE)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
Temp& = uprint(CaptionIndent, ((This.Height \ 2) - uspacing& \ 2) + 1, TempCaption$, LEN(TempCaption$), TempColor~&, 0)
@ -364,7 +364,7 @@ SUB __UI_DrawCheckBox (This AS __UI_ControlTYPE, ControlState AS _BYTE)
This.FocusState = __UI_Focus = This.ID
This.PreviousValue = This.Value
__UI_TempCaptions(This.ID) = Caption(This.ID)
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -398,7 +398,7 @@ SUB __UI_DrawCheckBox (This AS __UI_ControlTYPE, ControlState AS _BYTE)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
Temp& = uprint(CaptionIndent, ((This.Height \ 2) - uspacing& \ 2) + 1, TempCaption$, LEN(TempCaption$), TempColor~&, 0)
@ -437,7 +437,7 @@ SUB __UI_DrawProgressBar (This AS __UI_ControlTYPE, ControlState)
This.FocusState = __UI_Focus = This.ID
This.PreviousValue = This.Value
__UI_TempCaptions(This.ID) = Caption(This.ID)
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -497,7 +497,7 @@ SUB __UI_DrawProgressBar (This AS __UI_ControlTYPE, ControlState)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 70)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 70)
END IF
Temp& = __UI_PrintWidth(TempCaption$)
@ -537,7 +537,7 @@ SUB __UI_DrawTrackBar (This AS __UI_ControlTYPE, ControlState)
This.ControlState = TempControlState
This.FocusState = __UI_Focus = This.ID
This.PreviousValue = This.Value
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -614,14 +614,14 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
'IF Text(This.ID) <> __UI_TempTexts(This.ID) THEN
' __UI_TempTexts(This.ID) = Text(This.ID)
' IF This.Multiline THEN
' This.HasHScrollbar = __UI_False
' This.HasHScrollbar = False
' DIM TempWidth AS LONG
' This.LongestLine = 0
' FOR i = 1 TO __UI_CountLines(This.ID)
' TempWidth = __UI_PrintWidth(__UI_GetTextBoxLine$(This.ID, i, 0))
' IF TempWidth > This.LongestLine THEN This.LongestLine = TempWidth
' IF (This.LongestLine > This.Width AND This.HasVScrollBar = __UI_False) OR (This.LongestLine > This.Width - __UI_ScrollbarWidth AND This.HasVScrollBar = __UI_True) THEN
' This.HasHScrollbar = __UI_True
' IF (This.LongestLine > This.Width AND This.HasVScrollBar = False) OR (This.LongestLine > This.Width - __UI_ScrollbarWidth AND This.HasVScrollBar = True) THEN
' This.HasHScrollbar = True
' END IF
' NEXT
' END IF
@ -629,7 +629,7 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
This.SelectionLength = __UI_SelectionLength
This.PrevCursor = This.Cursor
This.PrevVisibleCursor = This.VisibleCursor
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
This.PrevFirstVisibleLine = This.FirstVisibleLine
This.PrevCurrentLine = This.CurrentLine
@ -656,7 +656,7 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
IF NOT This.Disabled AND LEN(Text(This.ID)) THEN
COLOR This.ForeColor, This.BackColor
ELSE
COLOR __UI_Darken(Control(__UI_FormID).BackColor, 80), This.BackColor
COLOR Darken(Control(__UI_FormID).BackColor, 80), This.BackColor
END IF
STATIC c AS _UNSIGNED LONG
@ -682,7 +682,7 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
cursorBlink%% = NOT cursorBlink%%
ELSEIF TIMER - __UI_LastInputReceived < .1 THEN
SetCursor# = TIMER
cursorBlink%% = __UI_True
cursorBlink%% = True
END IF
IF cursorBlink%% THEN
IF This.Cursor > UBOUND(__UI_ThisLineChars) THEN This.Cursor = UBOUND(__UI_ThisLineChars)
@ -717,7 +717,7 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
cursorBlink%% = NOT cursorBlink%%
ELSEIF TIMER - __UI_LastInputReceived < .1 THEN
SetCursor# = TIMER
cursorBlink%% = __UI_True
cursorBlink%% = True
END IF
FOR ThisLine = This.FirstVisibleLine TO TotalLines
@ -761,10 +761,10 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState, ss1 AS LONG, ss2 A
IF TotalLines > This.Height \ uspacing& THEN
This.FieldArea = This.Width / _FONTWIDTH((This.Font)) - 3
This.HasVScrollbar = __UI_True
This.HasVScrollbar = True
__UI_DrawVScrollBar This, ControlState
ELSE
This.HasVScrollbar = __UI_False
This.HasVScrollbar = False
END IF
'IF This.HasHScrollbar THEN
@ -796,7 +796,7 @@ SUB __UI_DrawListBox (This AS __UI_ControlTYPE, ControlState)
This.PreviousValue = This.Value
This.PreviousInputViewStart = This.InputViewStart
__UI_TempTexts(This.ID) = Text(This.ID)
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -845,7 +845,7 @@ SUB __UI_DrawListBox (This AS __UI_ControlTYPE, ControlState)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
IF ThisItem% = This.Value THEN
@ -870,14 +870,14 @@ SUB __UI_DrawListBox (This AS __UI_ControlTYPE, ControlState)
IF This.LastVisibleItem = 0 THEN This.LastVisibleItem = LastVisibleItem
IF This.Max > This.LastVisibleItem THEN
This.HasVScrollbar = __UI_True
This.HasVScrollbar = True
__UI_DrawVScrollBar This, ControlState
ELSE
This.HasVScrollbar = __UI_False
This.HasVScrollbar = False
END IF
END IF
IF This.HasBorder = __UI_True THEN
IF This.HasBorder = True THEN
LINE (0, 0)-STEP(This.Width - 1, This.Height - 1), This.BorderColor, B
END IF
'------
@ -946,10 +946,10 @@ SUB __UI_DrawVScrollBar (TempThis AS __UI_ControlTYPE, ControlState AS _BYTE)
END IF
'Mousedown on the track:
IF __UI_MouseDownOnID = This.ID AND This.HoveringVScrollbarButton = 4 AND __UI_DraggingThumb = __UI_False THEN
IF __UI_MouseDownOnID = This.ID AND This.HoveringVScrollbarButton = 4 AND __UI_DraggingThumb = False THEN
'Above the thumb
_PUTIMAGE (This.Left, This.Top)-STEP(ImageWidth_Button - 1, ThumbTop + ThumbHeight + __UI_ScrollbarButtonHeight - 1), ControlImage_Track, , (0, 3 * ImageHeight_Button - ImageHeight_Button)-STEP(ImageWidth_Button - 1, ImageHeight_Button - 1)
ELSEIF __UI_MouseDownOnID = This.ID AND This.HoveringVScrollbarButton = 5 AND __UI_DraggingThumb = __UI_False THEN
ELSEIF __UI_MouseDownOnID = This.ID AND This.HoveringVScrollbarButton = 5 AND __UI_DraggingThumb = False THEN
'Below the thumb
_PUTIMAGE (This.Left, This.Top + ThumbTop + __UI_ScrollbarButtonHeight)-STEP(ImageWidth_Button - 1, This.Height - (This.Top + ThumbTop + __UI_ScrollbarButtonHeight) - 1), ControlImage_Track, , (0, 3 * ImageHeight_Button - ImageHeight_Button)-STEP(ImageWidth_Button - 1, ImageHeight_Button - 1)
END IF
@ -972,11 +972,11 @@ SUB __UI_DrawVScrollBar (TempThis AS __UI_ControlTYPE, ControlState AS _BYTE)
END IF
'Draw thumb
IF __UI_DraggingThumb = __UI_True THEN
IF __UI_DraggingThumb = True THEN
_PUTIMAGE (This.Left + 1, ThumbTop + __UI_ScrollbarButtonHeight)-STEP(ImageWidth_Thumb - 2, ThumbHeight - 1), ControlImage_Thumb, , (0, 3 * ImageHeight_Thumb - ImageHeight_Thumb + 2)-STEP(ImageWidth_Thumb - 1, ImageHeight_Thumb - 5)
_PUTIMAGE (This.Left + 1, ThumbTop + __UI_ScrollbarButtonHeight)-STEP(ImageWidth_Thumb - 2, 1), ControlImage_Thumb, , (0, 3 * ImageHeight_Thumb - ImageHeight_Thumb)-STEP(ImageWidth_Thumb - 1, 1)
_PUTIMAGE (This.Left + 1, ThumbTop + __UI_ScrollbarButtonHeight + ThumbHeight - 2)-STEP(ImageWidth_Thumb - 2, 1), ControlImage_Thumb, , (0, 3 * ImageHeight_Thumb - 4)-STEP(ImageWidth_Thumb - 1, 3)
ELSEIF This.HoveringVScrollbarButton = 3 AND __UI_DraggingThumb = __UI_False THEN
ELSEIF This.HoveringVScrollbarButton = 3 AND __UI_DraggingThumb = False THEN
_PUTIMAGE (This.Left + 1, ThumbTop + __UI_ScrollbarButtonHeight)-STEP(ImageWidth_Thumb - 2, ThumbHeight - 1), ControlImage_Thumb, , (0, 2 * ImageHeight_Thumb - ImageHeight_Thumb + 2)-STEP(ImageWidth_Thumb - 1, ImageHeight_Thumb - 5)
_PUTIMAGE (This.Left + 1, ThumbTop + __UI_ScrollbarButtonHeight)-STEP(ImageWidth_Thumb - 2, 1), ControlImage_Thumb, , (0, 2 * ImageHeight_Thumb - ImageHeight_Thumb)-STEP(ImageWidth_Thumb - 1, 1)
_PUTIMAGE (This.Left + 1, ThumbTop + __UI_ScrollbarButtonHeight + ThumbHeight - 2)-STEP(ImageWidth_Thumb - 2, 1), ControlImage_Thumb, , (0, 2 * ImageHeight_Thumb - 4)-STEP(ImageWidth_Thumb - 1, 3)
@ -1023,7 +1023,7 @@ SUB __UI_DrawDropdownList (This AS __UI_ControlTYPE, ControlState)
This.PreviousValue = This.Value
This.PreviousInputViewStart = This.InputViewStart
__UI_TempTexts(This.ID) = Text(This.ID)
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
IF This.Canvas <> 0 THEN
@ -1044,7 +1044,7 @@ SUB __UI_DrawDropdownList (This AS __UI_ControlTYPE, ControlState)
END IF
CaptionIndent = 0
IF This.HasBorder = __UI_True THEN
IF This.HasBorder = True THEN
CaptionIndent = 5
LINE (0, 0)-STEP(This.Width - 1, This.Height - 1), This.BorderColor, B
END IF
@ -1072,7 +1072,7 @@ SUB __UI_DrawDropdownList (This AS __UI_ControlTYPE, ControlState)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
IF __UI_Focus = This.ID THEN
@ -1099,7 +1099,7 @@ SUB __UI_DrawDropdownList (This AS __UI_ControlTYPE, ControlState)
DropdownState = 3
ELSEIF (This.ID = __UI_HoveringID OR This.ID = __UI_ParentDropdownList) AND NOT This.Disabled THEN
DropdownState = 2
ELSEIF This.Disabled = __UI_True THEN
ELSEIF This.Disabled = True THEN
DropdownState = 4
ELSE
DropdownState = 1
@ -1147,7 +1147,7 @@ SUB __UI_DrawFrame (This AS __UI_ControlTYPE)
IF This.ChildrenRedrawn OR Caption(This.ID) <> __UI_TempCaptions(This.ID) OR This.HelperCanvas = 0 OR (__UI_IsDragging AND Control(__UI_DraggingID).ParentID = This.ID) OR This.Value <> This.PreviousValue OR __UI_ForceRedraw OR __UI_DesignMode THEN
'Last time we drew this frame its children had different images
This.ChildrenRedrawn = __UI_False
This.ChildrenRedrawn = False
This.PreviousValue = This.Value
__UI_TempCaptions(This.ID) = Caption(This.ID)
@ -1162,7 +1162,7 @@ SUB __UI_DrawFrame (This AS __UI_ControlTYPE)
_FONT This.Font
IF This.Hidden = __UI_False THEN
IF This.Hidden = False THEN
IF This.BackStyle = __UI_Opaque THEN
CLS , This.BackColor
ELSE
@ -1175,7 +1175,7 @@ SUB __UI_DrawFrame (This AS __UI_ControlTYPE)
IF NOT This.Disabled THEN
TempColor~& = This.ForeColor
ELSE
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
'This.Canvas holds the children controls' images
@ -1274,7 +1274,7 @@ SUB __UI_DrawMenuBar (This AS __UI_ControlTYPE, ControlState AS _BYTE)
END IF
IF This.Disabled THEN
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
END IF
Temp& = uprint(__UI_MenuBarOffset, ((This.Height \ 2) - uspacing& \ 2), TempCaption$, LEN(TempCaption$), TempColor~&, 0)
@ -1287,7 +1287,7 @@ SUB __UI_DrawMenuBar (This AS __UI_ControlTYPE, ControlState AS _BYTE)
IF __UI_DesignMode THEN
IF This.Left + This.Width = __UI_NewMenuBarTextLeft THEN
'Last menu bar item. Next is "Add new"
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
_DEST Control(__UI_FormID).Canvas
_FONT (This.Font)
Temp& = uprint(__UI_NewMenuBarTextLeft + __UI_MenuBarOffset, ((This.Height \ 2) - uspacing& \ 2), "Add new", 7, TempColor~&, 0)
@ -1346,10 +1346,10 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
TempCaption$ = __UI_TrimAt0$(Caption(i))
IF RIGHT$(TempCaption$, 1) = "-" THEN
HasSeparator = __UI_True
HasSeparator = True
TempCaption$ = LEFT$(TempCaption$, LEN(TempCaption$) - 1)
ELSE
HasSeparator = __UI_False
HasSeparator = False
END IF
IF __UI_Focus = i OR (__UI_HoveringID = i AND __UI_Focus = i) THEN
@ -1362,7 +1362,7 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
END IF
IF Control(i).Disabled THEN
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
CheckMarkIndex = 3
END IF
@ -1374,7 +1374,7 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
LINE (Control(i).Left + __UI_MenuItemOffset + Control(i).HotKeyOffset, Control(i).Top + Control(i).Height \ 2 + uheight& \ 2 - 1)-STEP(Temp& - 1, 0), TempColor~&
END IF
IF Control(i).Value = __UI_True THEN
IF Control(i).Value = True THEN
'Checked menu item
_PUTIMAGE (__UI_MenuItemOffset \ 2 - CheckMarkWidth \ 2, Control(i).Top + Control(i).Height \ 2 - CheckMarkHeight \ 2), ControlImage, , (0, CheckMarkIndex * CheckMarkHeight - CheckMarkHeight)-STEP(6, 6)
ELSE
@ -1395,7 +1395,7 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, ControlState AS _BYTE)
NEXT
IF __UI_DesignMode AND LEFT$(This.Name, 5) <> "__UI_" THEN
TempColor~& = __UI_Darken(Control(__UI_FormID).BackColor, 80)
TempColor~& = Darken(Control(__UI_FormID).BackColor, 80)
Temp& = uprint(__UI_MenuItemOffset, This.Height - (uheight& + 6), "Add new", 7, TempColor~&, 0)
END IF
'---
@ -1415,7 +1415,7 @@ SUB __UI_DrawPictureBox (This AS __UI_ControlTYPE, ControlState AS _BYTE)
IF This.Stretch <> This.PreviousStretch OR This.PreviousValue <> This.HelperCanvas OR This.ControlState <> ControlState OR This.PreviousParentID <> This.ParentID OR __UI_ForceRedraw THEN
'Last time this control was drawn it had a different state/caption, so it'll be redrawn
This.ControlState = ControlState
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = __UI_True
IF This.ParentID THEN Control(This.ParentID).ChildrenRedrawn = True
This.PreviousParentID = This.ParentID
This.PreviousValue = This.HelperCanvas
This.PreviousStretch = This.Stretch
@ -1441,7 +1441,7 @@ SUB __UI_DrawPictureBox (This AS __UI_ControlTYPE, ControlState AS _BYTE)
_PUTIMAGE (0, 0), This.HelperCanvas, This.Canvas
END IF
IF This.HasBorder = __UI_True THEN
IF This.HasBorder = True THEN
LINE (0, 0)-STEP(This.Width - 1, This.Height - 1), This.BorderColor, B
END IF
'------