Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 418
» Latest member: Ascentqke
» Forum threads: 2,398
» Forum posts: 23,360

Full Statistics

Latest Threads
The L-BASIC compiler
Forum: Works in Progress
Last Post: Jack
1 hour ago
» Replies: 21
» Views: 959
Stop screen from resizing
Forum: Help Me!
Last Post: SMcNeill
3 hours ago
» Replies: 2
» Views: 24
LEN for arrays is undocum...
Forum: Wiki Discussion
Last Post: luke
4 hours ago
» Replies: 0
» Views: 28
Extended KotD #9: _WriteF...
Forum: Keyword of the Day!
Last Post: SMcNeill
9 hours ago
» Replies: 0
» Views: 22
QB64PE Version 3.13 is no...
Forum: Announcements
Last Post: hsiangch_ong
Today, 12:57 AM
» Replies: 16
» Views: 510
Bug in IDE v3.13.1
Forum: GitHub Discussion
Last Post: SMcNeill
Yesterday, 11:28 PM
» Replies: 2
» Views: 51
My 1st Demo
Forum: Works in Progress
Last Post: JRace
Yesterday, 10:22 PM
» Replies: 1
» Views: 66
Loop variables
Forum: GitHub Discussion
Last Post: SMcNeill
Yesterday, 07:45 PM
» Replies: 7
» Views: 90
setting program to displa...
Forum: Help Me!
Last Post: madscijr
Yesterday, 05:42 PM
» Replies: 8
» Views: 110
A very simple game of mat...
Forum: Games
Last Post: Delsus
Yesterday, 04:39 PM
» Replies: 0
» Views: 27

 
  Keybone's GUI ("OS/3 Operating Environment 2.01 ALPHA")
Posted by: Keybone - 04-19-2022, 05:50 PM - Forum: Keybone - No Replies

I created this version of my GUI in the end of 2019. It's still incomplete and has bugs.
Mostly I created this version to show off 2 new themes I made at the time: MacOS and BeOS.
This also includes the Win3.x, Motif-like, and blank themes. Plus many miscellaneous things.

Working:
window moving
window resizing

Non-working:
minimizing window
maximizing window
closing window
raise/focus window

Obligatory Screenshot:

[Image: os3-multitheme-bg.png]


Installation:

1) Copy os3_201a.txt and Gold1.png into your qb64 folder.
2) Rename os3_201a.txt to os3_201a.bas.
3) Compile and run os3_201a.bas

Gold1.png:

[Image: Gold1.png]

os3_201a.bas:



Attached Files
.txt   os3_201a.txt (Size: 69.08 KB / Downloads: 69)
Print this item

  Keybone's GUI (Widgets, Windows, and Background)
Posted by: Keybone - 04-19-2022, 05:07 PM - Forum: Keybone - No Replies

This is a version of the widget toolkit. This version is not finished.
When I stopped working on it, I was in the process of adding windows.
They are included but do not actually do anything other than drawing on the screen.
All the widgets still work, and the background image system is fully operational.

Obligatory screenshot:

[Image: bg-toolkit1.png]

[Image: bg-toolkit2.png]


Installation:

1) copy kwin2.bas and ggravity.jpg to your qb64 folder
2) compile and run kwin2.bas


ggravity.jpg:

[Image: ggravity.jpg]


kwin2.bas:

Code: (Select All)
Type aDisplayOption
    Fullscreen As _Byte
    Scaled As _Byte
    Smoothed As _Byte
End Type

Type aBackgroundOption
    Scaled As _Byte
    Centered As _Byte
    Tiled As _Byte
    Image As _Byte
    Solid As _Byte
    solidColour As _Unsigned Long
    horizontalGradient As _Byte
    verticalGradient As _Byte
    diagonalGradient As _Byte
    horizontalDither As _Byte
    verticalDither As _Byte
    checkerboxDither As _Byte
    horizontalSpacedDither As _Byte
    verticalSpacedDither As _Byte
    squareSpacedDither As _Byte
    squarePattern As _Byte
    ditherSpacing As _Unsigned Integer
    colour1 As _Unsigned Long
    colour2 As _Unsigned Long
End Type

Type anOption
    Display As aDisplayOption
    Background As aBackgroundOption
End Type

Type aSize
    restoredSizeX As _Unsigned Integer
    restoredSizeY As _Unsigned Integer
    maximizedSizeX As _Unsigned Integer
    maximizedSizeY As _Unsigned Integer
End Type

Type aProperty
    isMinimizable As _Byte
    isRestorable As _Byte
    isMaximizable As _Byte
    isMovable As _Byte
    isResizable As _Byte
End Type

Type aStatus
    isMinimized As _Byte
    isRestored As _Byte
    isMaximized As _Byte
    isMoving As _Byte
    isResizing As _Byte
End Type

Type aWindow
    positionX As Integer
    positionY As Integer
    Size As aSize
    restoredImageHandle As _Unsigned Long
    maximizedImageHandle As _Unsigned Long
    Properties As aProperty
    Status As aStatus
    isActive As _Byte
End Type

Type anIcon
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    imageHandle As _Unsigned Long
End Type

Type anObject
    Title As String
    Identifier As String
    Windows As aWindow
    Icons As anIcon
End Type

Type aButton
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    Text As String
    imageHandle As _Unsigned Long
End Type

Type aCheckbox
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    isChecked As _Byte
    Text As String
    imageHandle1 As _Unsigned Long
    imageHandle2 As _Unsigned Long
End Type

Type aSwitch
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    isEnabled As _Byte
    Text As String
    imageHandle1 As _Unsigned Long
    imageHandle2 As _Unsigned Long
End Type

Type aRadiobutton
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    groupID As _Unsigned Integer
    isSelected As _Byte
    Text As String
    imageHandle1 As _Unsigned Long
    imageHandle2 As _Unsigned Long
End Type

Type aMouse
    positionX As Integer
    positionY As Integer
    buttonLeft As _Byte
    buttonMiddle As _Byte
    buttonRight As _Byte
End Type

Type aGrayscale
    Black As _Unsigned Long
    Darkest As _Unsigned Long
    Darker As _Unsigned Long
    Dark As _Unsigned Long
    Neutral As _Unsigned Long
    Light As _Unsigned Long
    Lighter As _Unsigned Long
    Lightest As _Unsigned Long
    White As _Unsigned Long
End Type

Type aPrimaryColour
    Red As _Unsigned Long
    Green As _Unsigned Long
    Blue As _Unsigned Long
End Type

Type aSecondaryColour
    Cyan As _Unsigned Long
    Magenta As _Unsigned Long
    Yellow As _Unsigned Long
End Type

Type aTertiaryColour
    Azure As _Unsigned Long
    Violet As _Unsigned Long
    Rose As _Unsigned Long
    Orange As _Unsigned Long
    Chartreuse As _Unsigned Long
    springGreen As _Unsigned Long
End Type

Type aPalette
    Grayscale As aGrayscale
    Primary As aPrimaryColour
    Secondary As aSecondaryColour
    Tertiary As aTertiaryColour
End Type

Type aLimit
    Minimum As _Unsigned Integer
    Current As _Unsigned Integer
    Maximum As _Unsigned Integer
End Type

Dim Shared Limit As aLimit
Limit.Minimum = 0
Limit.Current = Limit.Minimum
Limit.Maximum = 0 - 1

Dim Shared limitObjects As aLimit
limitObjects.Minimum = 0
limitObjects.Current = limitObjects.Minimum
limitObjects.Maximum = 0 - 1

Dim Shared limitButtons As aLimit
limitButtons.Minimum = 0
limitButtons.Current = limitButtons.Minimum
limitButtons.Maximum = 0 - 1

Dim Shared limitCheckboxes As aLimit
limitCheckboxes.Minimum = 0
limitCheckboxes.Current = limitCheckboxes.Minimum
limitCheckboxes.Maximum = 0 - 1

Dim Shared limitSwitches As aLimit
limitSwitches.Minimum = 0
limitSwitches.Current = limitSwitches.Minimum
limitSwitches.Maximum = 0 - 1

Dim Shared limitRadiobuttons As aLimit
limitRadiobuttons.Minimum = 0
limitRadiobuttons.Current = limitRadiobuttons.Minimum
limitRadiobuttons.Maximum = 0 - 1

ReDim Shared Objects(Limit.Current) As anObject
ReDim Shared Buttons(limitButtons.Current) As aButton
ReDim Shared Checkboxes(limitCheckboxes.Current) As aCheckbox
ReDim Shared Switches(limitSwitches.Current) As aSwitch
ReDim Shared Radiobuttons(limitRadiobuttons.Current) As aRadiobutton
Dim Shared Mouse As aMouse

Dim Shared theOptions As anOption
theOptions.Display.Fullscreen = 0
theOptions.Display.Scaled = 0
theOptions.Display.Smoothed = -1

Dim Shared theDesktop As _Unsigned Long
theDesktop.sizeX = 640
theDesktop.sizeY = 480
theDesktop.imageHandle = _NewImage(theDesktop.sizeX, theDesktop.sizeY, 32)
Screen theDesktop.imageHandle

If theOptions.Display.Fullscreen Then
    If theOptions.Display.Scaled Then
        If theOptions.Display.Smoothed Then
            _FullScreen _Stretch , _Smooth
        Else
            _FullScreen _Stretch
        End If
    Else
        If theOptions.Display.Smoothed Then
            _FullScreen _SquarePixels , _Smooth
        Else
            _FullScreen _SquarePixels
        End If
    End If
End If
_PrintMode _KeepBackground

Dim Shared colorPalette As aPalette
colorPalette.Grayscale.Black = _RGBA32(0, 0, 0, 255)
colorPalette.Grayscale.Darkest = _RGBA32(31, 31, 31, 255)
colorPalette.Grayscale.Darker = _RGBA32(63, 63, 63, 255)
colorPalette.Grayscale.Dark = _RGBA32(95, 95, 95, 255)
colorPalette.Grayscale.Neutral = _RGBA32(127, 127, 127, 255)
colorPalette.Grayscale.Light = _RGBA32(159, 159, 159, 255)
colorPalette.Grayscale.Lighter = _RGBA32(191, 191, 191, 255)
colorPalette.Grayscale.Lightest = _RGBA32(223, 223, 223, 255)
colorPalette.Grayscale.White = _RGBA32(255, 255, 255, 255)
colorPalette.Primary.Red = _RGBA32(255, 0, 0, 255)
colorPalette.Primary.Green = _RGBA32(0, 255, 0, 255)
colorPalette.Primary.Blue = _RGBA32(0, 0, 255, 255)
colorPalette.Secondary.Cyan = _RGBA32(255, 0, 0, 255)
colorPalette.Secondary.Magenta = _RGBA32(255, 0, 0, 255)
colorPalette.Secondary.Yellow = _RGBA32(255, 0, 0, 255)
colorPalette.Tertiary.Azure = _RGBA32(0, 127, 255, 255)
colorPalette.Tertiary.Violet = _RGBA32(127, 0, 255, 255)
colorPalette.Tertiary.Rose = _RGBA32(255, 0, 127, 255)
colorPalette.Tertiary.springGreen = _RGBA32(0, 255, 127, 255)
colorPalette.Tertiary.Orange = _RGBA32(255, 165, 0, 255)
colorPalette.Tertiary.Chartreuse = _RGBA32(127, 255, 0, 255)

Dim Shared theBackground As _Unsigned Long

theBackground.imageHandle = _LoadImage("ggravity.jpg")
theBackground.sizeX = _Width(theBackground.imageHandle)
theBackground.sizeY = _Height(theBackground.imageHandle)

If theBackground.imageHandle Then
    theOptions.Background.Image = -1
    theOptions.Background.Scaled = 0
    theOptions.Background.Centered = 0
    theOptions.Background.Tiled = 0
End If

initObject 100, 100, 200, 200, "Window 1", "Window Title 1"
initObject 200, 200, 200, 200, "Window 2", "Window Title 2"
initObject 300, 300, 200, 200, "Window 3", "Window Title 3"
initButton 100, 200, 100, 40, "Button"
initCheckbox 100, 400, 50, -1, "Checkbox"
initSwitch 200, 150, 25, 0, "Switch"
initRadiobutton 550, 100, 50, 1, -1, "Radiobutton 1"
initRadiobutton 550, 175, 50, 1, 0, "Radiobutton 2"
initRadiobutton 550, 250, 50, 1, 0, "Radiobutton 3"

Dim Shared zoneTypeClicked As String

theOptions.Background.Solid = 0
theOptions.Background.solidColour = thePalette.Tertiary.Azure
theOptions.Background.horizontalGradient = 0
theOptions.Background.verticalGradient = 0
theOptions.Background.diagonalGradient = 0
theOptions.Background.horizontalDither = -1
theOptions.Background.verticalDither = 0
theOptions.Background.checkerboxDither = 0
theOptions.Background.horizontalSpacedDither = 0
theOptions.Background.verticalSpacedDither = 0
theOptions.Background.squareSpacedDither = 0
theOptions.Background.squarePattern = 0
theOptions.Background.ditherSpacing = 3
theOptions.Background.colour1 = thePalette.Tertiary.Azure
theOptions.Background.colour2 = thePalette.Tertiary.Violet

Do
    If theOptions.Background.Solid Then
        Line (0, 0)-(_Width, _Height), theOptions.Background.solidColour, BF
    Else
        If theOptions.Background.horizontalGradient Then
            gradientHorizontal 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2
        Else
            If theOptions.Background.verticalGradient Then
                gradientVertical 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2
            Else
                If theOptions.Background.diagonalGradient Then
                    gradientDiagonal 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2
                Else
                    If theOptions.Background.horizontalDither Then
                        ditherHorizontal 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2, theOptions.Background.ditherSpacing
                    Else
                        If theOptions.Background.verticalDither Then
                            ditherVertical 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2, theOptions.Background.ditherSpacing
                        Else
                            If theOptions.Background.checkerboxDither Then
                                ditherCheckerbox 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2
                            Else
                                If theOptions.Background.horizontalSpacedDither Then
                                    ditherHorizontalSpaced 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2, theOptions.Background.ditherSpacing
                                Else
                                    If theOptions.Background.verticalSpacedDither Then
                                        ditherVerticalSpaced 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2, theOptions.Background.ditherSpacing
                                    Else
                                        If theOptions.Background.squareSpacedDither Then
                                            ditherSquare 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2, theOptions.Background.ditherSpacing
                                        Else
                                            If theOptions.Background.squarePattern Then
                                                patternSquare 0, 0, _Width, _Height, theOptions.Background.colour1, theOptions.Background.colour2, theOptions.Background.ditherSpacing
                                            Else
                                                Line (0, 0)-(_Width, _Height), thePalette.Grayscale.Black, BF
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End If

    If theOptions.Background.Image Then
        If theOptions.Background.Scaled Then
            _PutImage (0, 0)-(_Width(theDisplay.imageHandle), _Height(theDisplay.imageHandle)), theBackground.imageHandle, theDisplay.imageHandle
        Else
            If theOptions.Background.Centered Then
                Dim centeredX As Integer: centeredX = (_Width(theDisplay.imageHandle) - _Width(theBackground.imageHandle)) / 2
                Dim centeredY As Integer: centeredY = (_Height(theDisplay.imageHandle) - _Height(theBackground.imageHandle)) / 2
                _PutImage (centeredX, centeredY)-(_Width(theBackground.imageHandle) + centeredX, _Height(theBackground.imageHandle) + centeredY), theBackground.imageHandle, theDisplay.imageHandle
            Else
                If theOptions.Background.Tiled Then
                    Dim numberWide As Single: numberWide = _Width / _Width(Temporary)
                    Dim numberHigh As Single: numberHigh = _Height / _Height(Temporary)
                    Dim currentTileY As _Unsigned Integer: For currentTileY = 0 To numberHigh
                        Dim currentTileX As _Unsigned Integer: For currentTileX = 0 To numberWide
                            _PutImage (_Width(theBackground.imageHandle) * currentTileX, _Height(theBackground.imageHandle) * currentTileY), theBackground.imageHandle, theDisplay.imageHandle
                        Next currentTileX
                    Next currentTileY
                Else
                    _PutImage (0, 0)-(_Width(theBackground.imageHandle), _Height(theBackground.imageHandle)), theBackground.imageHandle, theDisplay.imageHandle
                End If
            End If
        End If
    End If

    For i1 = 0 To limitButtons.Current
        _PutImage (Buttons(i1).positionX, Buttons(i1).positionY), Buttons(i1).imageHandle
    Next i1

    For i2 = 0 To Limit.Current
        _PutImage (Objects(i2).Windows.positionX, Objects(i2).Windows.positionY), Objects(i2).Windows.restoredImageHandle
    Next i2

    For i3 = 0 To limitCheckboxes.Current
        If Checkboxes(i3).isChecked Then
            _PutImage (Checkboxes(i3).positionX, Checkboxes(i3).positionY), Checkboxes(i3).imageHandle2
        Else
            _PutImage (Checkboxes(i3).positionX, Checkboxes(i3).positionY), Checkboxes(i3).imageHandle1
        End If
    Next i3

    For i4 = 0 To limitSwitches.Current
        If Switches(i4).isEnabled Then
            _PutImage (Switches(i4).positionX, Switches(i4).positionY), Switches(i4).imageHandle2
        Else
            _PutImage (Switches(i4).positionX, Switches(i4).positionY), Switches(i4).imageHandle1
        End If
    Next i4

    For i5 = 0 To limitRadiobuttons.Current
        If Radiobuttons(i5).isSelected Then
            _PutImage (Radiobuttons(i5).positionX, Radiobuttons(i5).positionY), Radiobuttons(i5).imageHandle2
        Else
            _PutImage (Radiobuttons(i5).positionX, Radiobuttons(i5).positionY), Radiobuttons(i5).imageHandle1
        End If
    Next i5

    probeMouse

    If Mouse.buttonLeft Then

        For i = 0 To LimitWindows.Current
            Status1 = isZone~&(i, "window")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "window"
                GoTo skip
            End If
        Next i

        For i = 0 To LimitIcons.Current
            Status1 = isZone~&(i, "icon")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "icon"
                GoTo skip
            End If
        Next i

        For i = 0 To limitButtons.Current
            Status1 = isZone~&(i, "button")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "button"
                GoTo skip
            End If
        Next i

        For i = 0 To limitCheckboxes.Current
            Status1 = isZone~&(i, "checkbox")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "checkbox"
                GoTo skip
            End If
        Next i

        For i = 0 To limitSwitches.Current
            Status1 = isZone~&(i, "switch")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "switch"
                GoTo skip
            End If
        Next i

        For i = 0 To limitRadiobuttons.Current
            Status1 = isZone~&(i, "radiobutton")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "radiobutton"
            End If
        Next i

        skip:

        zoneTypeClicked = LCase$(LTrim$(RTrim$(zoneTypeClicked)))

        Select Case zoneTypeClicked
            Case "window"
            Case "icon"
            Case "button"
            Case "checkbox"
                If Checkboxes(status2).isChecked = -1 Then
                    Checkboxes(status2).isChecked = 0
                Else
                    Checkboxes(status2).isChecked = -1
                End If
            Case "switch"
                If Switches(status2).isEnabled = -1 Then
                    Switches(status2).isEnabled = 0
                Else
                    Switches(status2).isEnabled = -1
                End If
            Case "radiobutton"
                For i = 0 To limitRadiobuttons.Current
                    If Radiobuttons(i).groupID = Radiobuttons(status2).groupID Then
                        Radiobuttons(i).isSelected = 0
                    End If
                Next i
                Radiobuttons(status2).isSelected = -1
        End Select
    End If

    _Limit 60
    _Display
Loop

Sub initObject (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inIdentifier As String, inTitle As String)
    Limit.Current = Limit.Current + 1
    ReDim _Preserve Objects(Limit.Current) As anObject
    Objects(Limit.Current).Title = inTitle
    Objects(Limit.Current).Identifier = inIdentifier
    Objects(Limit.Current).Windows.positionX = inPositionX
    Objects(Limit.Current).Windows.positionY = inPositionY
    Objects(Limit.Current).Windows.Size.restoredSizeX = inSizeX
    Objects(Limit.Current).Windows.Size.restoredSizeY = inSizeY
    Objects(Limit.Current).Windows.Size.maximizedSizeX = _Width
    Objects(Limit.Current).Windows.Size.maximizedSizeY = _Height
    Objects(Limit.Current).Windows.restoredImageHandle = _NewImage(Objects(Limit.Current).Windows.Size.restoredSizeX, Objects(Limit.Current).Windows.Size.restoredSizeY, 32)
    Objects(Limit.Current).Windows.maximizedImageHandle = _NewImage(Objects(Limit.Current).Windows.Size.maximizedSizeX, Objects(Limit.Current).Windows.Size.maximizedSizeY, 32)
    Objects(Limit.Current).Windows.Properties.isMinimizable = -1
    Objects(Limit.Current).Windows.Properties.isRestorable = -1
    Objects(Limit.Current).Windows.Properties.isMaximizable = -1
    Objects(Limit.Current).Windows.Properties.isMovable = -1
    Objects(Limit.Current).Windows.Properties.isResizable = -1
    Objects(Limit.Current).Windows.Status.isMinimized = -1
    Objects(Limit.Current).Windows.Status.isRestored = 0
    Objects(Limit.Current).Windows.Status.isMaximized = 0
    Objects(Limit.Current).Windows.Status.isMoving = 0
    Objects(Limit.Current).Windows.Status.isResizing = 0
    Objects(Limit.Current).Windows.isActive = 0
    Objects(Limit.Current).Icons.positionX = Objects(Limit.Current).Windows.positionX + (Objects(Limit.Current).Windows.Size.restoredSizeX / 2)
    Objects(Limit.Current).Icons.positionY = Objects(Limit.Current).Windows.positionY + (Objects(Limit.Current).Windows.Size.restoredSizeY / 2)
    Objects(Limit.Current).Icons.imageHandle = _LoadImage("blank.png")
    Objects(Limit.Current).Icons.sizeX = _Width(Objects(Limit.Current).Icons.imageHandle)
    Objects(Limit.Current).Icons.sizeY = _Height(Objects(Limit.Current).Icons.imageHandle)
    _Dest Objects(Limit.Current).Windows.restoredImageHandle
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(127, 127, 127, 255), BF
    box 0, 0, _Width - 1, _Height - 1, 1
    box 0, 0, _Width - 1, _Height - 1, 1
    If Objects(Identifier).Windows.isActive = -1 Then
        Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 255, 255, 255)
    Else
        Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 127, 127, 255)
    End If
    box2 _Width - 48, 3, 20, 20, 1, 7
    box2 _Width - 25, 3, 20, 20, 1, 2
    box3 4, 3, 20, 20, 1, 1, 7
    _Dest 0
End Sub

Sub initButton (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inText As String)
    limitButtons.Current = limitButtons.Current + 1
    ReDim _Preserve Buttons(limitButtons.Current) As aButton
    Buttons(limitButtons.Current).positionX = inPositionX
    Buttons(limitButtons.Current).positionY = inPositionY
    Buttons(limitButtons.Current).sizeX = inSizeX
    Buttons(limitButtons.Current).sizeY = inSizeY
    Buttons(limitButtons.Current).Text = inText
    Buttons(limitButtons.Current).imageHandle = _NewImage(Buttons(limitButtons.Current).sizeX, Buttons(limitButtons.Current).sizeY, 32)
    _Dest Buttons(limitButtons.Current).imageHandle
    _PrintMode _KeepBackground
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 0, 255, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    _PrintString (5, 5), Buttons(limitButtons.Current).Text
    _Dest 0
End Sub

Sub initCheckbox (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inIsChecked As _Byte, inText As String)
    limitCheckboxes.Current = limitCheckboxes.Current + 1
    ReDim _Preserve Checkboxes(limitCheckboxes.Current) As aCheckbox
    Checkboxes(limitCheckboxes.Current).positionX = inPositionX
    Checkboxes(limitCheckboxes.Current).positionY = inPositionY
    Checkboxes(limitCheckboxes.Current).sizeX = inSize
    Checkboxes(limitCheckboxes.Current).sizeY = inSize
    Checkboxes(limitCheckboxes.Current).isChecked = inIsChecked
    Checkboxes(limitCheckboxes.Current).Text = inText
    Checkboxes(limitCheckboxes.Current).imageHandle1 = _NewImage(Checkboxes(limitCheckboxes.Current).sizeX, Checkboxes(limitCheckboxes.Current).sizeY, 32)
    Checkboxes(limitCheckboxes.Current).imageHandle2 = _NewImage(Checkboxes(limitCheckboxes.Current).sizeX, Checkboxes(limitCheckboxes.Current).sizeY, 32)
    _Dest Checkboxes(limitCheckboxes.Current).imageHandle2
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255)
    Line (2, _Height - 3)-(_Width - 3, 2), _RGBA32(255, 255, 255, 255)
    _Dest Checkboxes(limitCheckboxes.Current).imageHandle1
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    _Dest 0
End Sub

Sub initSwitch (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inIsEnabled As _Byte, inText As String)
    limitSwitches.Current = limitSwitches.Current + 1
    ReDim _Preserve Switches(limitSwitches.Current) As aSwitch
    Switches(limitSwitches.Current).positionX = inPositionX
    Switches(limitSwitches.Current).positionY = inPositionY
    Switches(limitSwitches.Current).sizeX = inSize
    Switches(limitSwitches.Current).sizeY = inSize * 2
    Switches(limitSwitches.Current).isEnabled = inIsEnabled
    Switches(limitSwitches.Current).Text = inText
    Switches(limitSwitches.Current).imageHandle1 = _NewImage(Switches(limitSwitches.Current).sizeX, Switches(limitSwitches.Current).sizeY, 32)
    Switches(limitSwitches.Current).imageHandle2 = _NewImage(Switches(limitSwitches.Current).sizeX, Switches(limitSwitches.Current).sizeY, 32)
    _Dest Switches(limitSwitches.Current).imageHandle2
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, 2)-(_Width - 3, _Height / 2), _RGBA32(255, 255, 255, 255), BF
    _Dest Switches(limitSwitches.Current).imageHandle1
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, _Height / 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255), BF
    _Dest 0
End Sub

Sub initRadiobutton (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inGroupID As _Unsigned Integer, inIsSelected As _Byte, inText As String)
    limitRadiobuttons.Current = limitRadiobuttons.Current + 1
    ReDim _Preserve Radiobuttons(limitRadiobuttons.Current) As aRadiobutton
    Radiobuttons(limitRadiobuttons.Current).positionX = inPositionX
    Radiobuttons(limitRadiobuttons.Current).positionY = inPositionY
    Radiobuttons(limitRadiobuttons.Current).sizeX = inSize
    Radiobuttons(limitRadiobuttons.Current).sizeY = inSize
    Radiobuttons(limitRadiobuttons.Current).groupID = inGroupID
    Radiobuttons(limitRadiobuttons.Current).isSelected = inIsSelected
    Radiobuttons(limitRadiobuttons.Current).Text = inText
    Radiobuttons(limitRadiobuttons.Current).imageHandle1 = _NewImage(Radiobuttons(limitRadiobuttons.Current).sizeX, Radiobuttons(limitRadiobuttons.Current).sizeY, 32)
    Radiobuttons(limitRadiobuttons.Current).imageHandle2 = _NewImage(Radiobuttons(limitRadiobuttons.Current).sizeX, Radiobuttons(limitRadiobuttons.Current).sizeY, 32)
    _Dest Radiobuttons(limitRadiobuttons.Current).imageHandle2
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 255, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255)
    Line (2, _Height - 3)-(_Width - 3, 2), _RGBA32(255, 255, 255, 255)
    _Dest Radiobuttons(limitRadiobuttons.Current).imageHandle1
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 255, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    _Dest 0
End Sub

Sub Titlebar (titlebarPositionX As _Unsigned Integer, titlebarPositionY As _Unsigned Integer, titlebarWidth As _Unsigned Integer, titlebarHeight As _Unsigned Integer, titlebarColor As _Unsigned Long)
    Line (titlebarPositionX, titlebarPositionY)-(titlebarPositionX + titlebarWidth, titlebarPositionY + titlebarHeight), titlebarColor, BF
End Sub

Sub box (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer)
    Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), colorPalette.Grayscale.Lighter, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), colorPalette.Grayscale.Darker, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), colorPalette.Grayscale.Neutral, BF
End Sub

Sub box2 (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer, interiorDepth As _Unsigned Integer)
    interiorDepth = interiorDepth * boxDepth
    Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), colorPalette.Grayscale.Darker, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), colorPalette.Grayscale.Lighter, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), colorPalette.Grayscale.Neutral, BF
    Line (boxPositionX + boxDepth + interiorDepth, boxPositionY + boxDepth + interiorDepth)-(boxPositionX + boxWidth - boxDepth - interiorDepth, boxPositionY + boxHeight - boxDepth - interiorDepth), colorPalette.Grayscale.Lighter, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepth, boxPositionY + (boxDepth * 2) + interiorDepth)-(boxPositionX + boxWidth - boxDepth - interiorDepth, boxPositionY + boxHeight - boxDepth - interiorDepth), colorPalette.Grayscale.Darker, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepth, boxPositionY + (boxDepth * 2) + interiorDepth)-(boxPositionX + boxWidth - (boxDepth * 2) - interiorDepth, boxPositionY + boxHeight - (boxDepth * 2) - interiorDepth), colorPalette.Grayscale.Neutral, BF
End Sub

Sub box3 (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer, interiorDepthX As _Unsigned Integer, interiorDepthY As _Unsigned Integer)
    interiorDepthX = interiorDepthX * boxDepth
    interiorDepthY = interiorDepthY * boxDepth
    Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), colorPalette.Grayscale.Darker, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), colorPalette.Grayscale.Lighter, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), colorPalette.Grayscale.Neutral, BF
    Line (boxPositionX + boxDepth + interiorDepthX, boxPositionY + boxDepth + interiorDepthY)-(boxPositionX + boxWidth - boxDepth - interiorDepthX, boxPositionY + boxHeight - boxDepth - interiorDepthY), colorPalette.Grayscale.Lighter, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepthX, boxPositionY + (boxDepth * 2) + interiorDepthY)-(boxPositionX + boxWidth - boxDepth - interiorDepthX, boxPositionY + boxHeight - boxDepth - interiorDepthY), colorPalette.Grayscale.Darker, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepthX, boxPositionY + (boxDepth * 2) + interiorDepthY)-(boxPositionX + boxWidth - (boxDepth * 2) - interiorDepthX, boxPositionY + boxHeight - (boxDepth * 2) - interiorDepthY), colorPalette.Grayscale.Neutral, BF
End Sub

Sub probeMouse
    While _MouseInput
    Wend
    Mouse.positionX = _MouseX
    Mouse.positionY = _MouseY
    Mouse.buttonLeft = _MouseButton(1)
    Mouse.buttonRight = _MouseButton(2)
    Mouse.buttonMiddle = _MouseButton(3)
End Sub

Function isZone~& (inIdentifier As _Unsigned Integer, inSelector As String)
    inSelector = LCase$(LTrim$(RTrim$(inSelector)))
    Select Case inSelector
        Case "window"
            If Mouse.positionX >= Objects(inIdentifier).Windows.positionX Then
                If Mouse.positionY >= Objects(inIdentifier).Windows.positionY Then
                    If Mouse.positionX <= Objects(inIdentifier).Windows.positionX + Objects(inIdentifier).Windows.Size.restoredSizeX Then
                        If Mouse.positionY <= Objects(inIdentifier).Windows.positionY + Objects(inIdentifier).Windows.Size.restoredSizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "icon"
            If Mouse.positionX >= Objects(inIdentifier).Icons.positionX Then
                If Mouse.positionY >= Objects(inIdentifier).Icons.positionY Then
                    If Mouse.positionX <= Objects(inIdentifier).Icons.positionX + Objects(inIdentifier).Icons.sizeX Then
                        If Mouse.positionY <= Objects(inIdentifier).Icons.positionY + Objects(inIdentifier).Icons.sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "button"
            If Mouse.positionX >= Buttons(inIdentifier).positionX Then
                If Mouse.positionY >= Buttons(inIdentifier).positionY Then
                    If Mouse.positionX <= Buttons(inIdentifier).positionX + Buttons(inIdentifier).sizeX Then
                        If Mouse.positionY <= Buttons(inIdentifier).positionY + Buttons(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "checkbox"
            If Mouse.positionX >= Checkboxes(inIdentifier).positionX Then
                If Mouse.positionY >= Checkboxes(inIdentifier).positionY Then
                    If Mouse.positionX <= Checkboxes(inIdentifier).positionX + Checkboxes(inIdentifier).sizeX Then
                        If Mouse.positionY <= Checkboxes(inIdentifier).positionY + Checkboxes(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "switch"
            If Mouse.positionX >= Switches(inIdentifier).positionX Then
                If Mouse.positionY >= Switches(inIdentifier).positionY Then
                    If Mouse.positionX <= Switches(inIdentifier).positionX + Switches(inIdentifier).sizeX Then
                        If Mouse.positionY <= Switches(inIdentifier).positionY + Switches(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "radiobutton"
            If Mouse.positionX >= Radiobuttons(inIdentifier).positionX Then
                If Mouse.positionY >= Radiobuttons(inIdentifier).positionY Then
                    If Mouse.positionX <= Radiobuttons(inIdentifier).positionX + Radiobuttons(inIdentifier).sizeX Then
                        If Mouse.positionY <= Radiobuttons(inIdentifier).positionY + Radiobuttons(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
    End Select
End Function

Sub gradientHorizontal (x0, y0, w, h, c1 As _Unsigned Long, c2 As _Unsigned Long)
    Dim mr As Double, mg As Double, mb As Double
    mr = (_Red(c2) - _Red(c1)) / w
    mg = (_Green(c2) - _Green(c1)) / w
    mb = (_Blue(c2) - _Blue(c1)) / w
    For x = 0 To w - 1
        r = _Red(c2) + (x - w) * mr
        g = _Green(c2) + (x - w) * mg
        b = _Blue(c2) + (x - w) * mb
        Line (x + x0, y0)-Step(0, h), _RGBA32(r, g, b, 255), BF
    Next
End Sub

Sub gradientVertical (x0, y0, w, h, c1 As _Unsigned Long, c2 As _Unsigned Long)
    Dim mr As Double, mg As Double, mb As Double
    mr = (_Red(c2) - _Red(c1)) / h
    mg = (_Green(c2) - _Green(c1)) / h
    mb = (_Blue(c2) - _Blue(c1)) / h
    For y = 0 To h - 1
        r = _Red(c2) + (y - h) * mr
        g = _Green(c2) + (y - h) * mg
        b = _Blue(c2) + (y - h) * mb
        Line (x0, y + y0)-Step(w, 0), _RGBA32(r, g, b, 255), BF
    Next
End Sub

Sub gradientDiagonal (x0, y0, w, h, c1 As _Unsigned Long, c2 As _Unsigned Long)
    Dim mr As Double, mg As Double, mb As Double
    dw = w + h
    mr = (_Red(c2) - _Red(c1)) / dw
    mg = (_Green(c2) - _Green(c1)) / dw
    mb = (_Blue(c2) - _Blue(c1)) / dw
    For d = 0 To dw - 1
        r = _Red(c2) + (d - dw) * mr
        g = _Green(c2) + (d - dw) * mg
        b = _Blue(c2) + (d - dw) * mb
        If d <= h - 1 Then
            Line (x0 + d, y0)-(x0, y0 + d), _RGBA32(r, g, b, 255)
        ElseIf d >= h And d <= w - 1 Then
            Line (x0 + d, y0)-(x0 + (d - h), y0 + h), _RGBA32(r, g, b, 255)
        ElseIf d >= w And d <= dw - 1 Then
            Line (x0 + w, y0 + (d - w))-(x0 + (d - h), y0 + h), _RGBA32(r, g, b, 255)
        End If
    Next d
End Sub

Sub ditherCheckerbox (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long)
    Line (x0, y0)-(x0 + w, y0 + h), inColor2, BF
    For j = y0 To y0 + h
        If j Mod 2 = 1 Then
            For i = x0 To x0 + w
                If i Mod 2 = 1 Then
                    PSet (i, j), inColor2
                Else
                    PSet (i, j), inColor1
                End If
            Next i
        Else
            For i = x0 To x0 + w
                If i Mod 2 = 0 Then
                    PSet (i, j), inColor2
                Else
                    PSet (i, j), inColor1
                End If
            Next i
        End If
    Next j
End Sub

Sub ditherVertical (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long, inSpacing As _Unsigned Integer)
    Line (x0, y0)-(x0 + w, y0 + h), inColor2, BF
    For j = y0 To y0 + h
        For i = x0 To (x0 + w) - 1 Step inSpacing
            PSet (i, j), inColor1
        Next i
    Next j
End Sub

Sub ditherHorizontal (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long, inSpacing As _Unsigned Integer)
    Line (x0, y0)-(x0 + w, y0 + h), inColor2, BF
    For i = x0 To (x0 + w) - 1
        For j = y0 To y0 + h Step inSpacing
            PSet (i, j), inColor1
        Next j
    Next i
End Sub

Sub ditherHorizontalSpaced (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long, inSpacing As _Unsigned Integer)
    cc = 1
    Line (x0, y0)-(x0 + w, y0 + h), inColor2, BF
    For i = x0 To x0 + w Step inSpacing
        Select Case cc
            Case 1
                For j = y0 To y0 + h
                    If j Mod 2 <> 0 Then
                        PSet (i, j), inColor1
                    End If
                Next j
                cc = cc + 1
            Case 2
                For j = y0 To y0 + h
                    If j Mod 2 = 0 Then
                        PSet (i, j), inColor1
                    End If
                Next j
                cc = 1
        End Select
    Next i
End Sub

Sub ditherVerticalSpaced (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long, inSpacing As _Unsigned Integer)
    cc = 1
    Line (x0, y0)-(x0 + w, y0 + h), inColor2, BF
    For i = y0 To y0 + h Step inSpacing
        Select Case cc
            Case 1
                For j = x0 To x0 + w
                    If j Mod 2 <> 0 Then
                        PSet (j, i), inColor1
                    End If
                Next j
                cc = cc + 1
            Case 2
                For j = x0 To x0 + w
                    If j Mod 2 = 0 Then
                        PSet (j, i), inColor1
                    End If
                Next j
                cc = 1
        End Select
    Next i
End Sub

Sub ditherSquare (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long, inSpacing As _Unsigned Integer)
    Line (x0, y0)-((x0 + w) - 1, (y0 + h) - 1), inColor2, BF
    For i = x0 To x0 + w Step inSpacing
        For j = y0 To y0 + h Step inSpacing
            PSet (i, j), inColor1
        Next j
    Next i
End Sub

Sub patternSquare (x0, y0, w, h, inColor1 As _Unsigned Long, inColor2 As _Unsigned Long, inSpacing As _Unsigned Integer)
    Line (x0, y0)-((x0 + w) - 1, (y0 + h) - 1), inColor2, BF
    For i = x0 To x0 + w Step inSpacing
        Line (centerX + i, y0)-(centerX + i, (y0 + h) - 1), inColor1
    Next i
    For i = y0 To y0 + h Step inSpacing
        Line (x0, centerY + i)-((x0 + w) - 1, centerY + i), inColor1
    Next i
End Sub

Print this item

  Keybone's GUI (04/2022 - Widget toolkit)
Posted by: Keybone - 04-19-2022, 04:38 PM - Forum: Keybone - No Replies

I wrote this shortly before my latest update (04/07/2022).
Unlike that update this is a widget toolkit and not a windowing system.
It can use some work, it has some glitches, and is not pretty.
You can't do anything advanced with this but it's worth a look.

Obligatory screenshots:

[Image: toolkit1.png]

[Image: toolkit2.png]


Installation:
1) Copy blank.png and k3.bas into your qb64 folder
2) Compile and run k3.bas


blank.png:

[Image: blank.png]


k3.bas:

Code: (Select All)
Screen _NewImage(640, 480, 32)
_PrintMode _KeepBackground

Type aWindow
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    Text As String
    imageHandle As _Unsigned Long
End Type

Type anIcon
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    Text As String
    imageHandle As _Unsigned Long
End Type

Type aButton
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    Text As String
    imageHandle As _Unsigned Long
End Type

Type aCheckbox
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    isChecked As _Byte
    Text As String
    imageHandle1 As _Unsigned Long
    imageHandle2 As _Unsigned Long
End Type

Type aSwitch
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    isEnabled As _Byte
    Text As String
    imageHandle1 As _Unsigned Long
    imageHandle2 As _Unsigned Long
End Type

Type aRadiobutton
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    groupID As _Unsigned Integer
    isSelected As _Byte
    Text As String
    imageHandle1 As _Unsigned Long
    imageHandle2 As _Unsigned Long
End Type

Type aMouse
    positionX As Integer
    positionY As Integer
    buttonLeft As _Byte
    buttonMiddle As _Byte
    buttonRight As _Byte
End Type

Type aLimit
    Minimum As _Unsigned Integer
    Current As _Unsigned Integer
    Maximum As _Unsigned Integer
End Type

Dim Shared theLimitWindows As aLimit
theLimitWindows.Minimum = 0
theLimitWindows.Current = theLimit.Minimum
theLimitWindows.Maximum = 0 - 1

Dim Shared theLimitIcons As aLimit
theLimitIcons.Minimum = 0
theLimitIcons.Current = theLimit.Minimum
theLimitIcons.Maximum = 0 - 1

Dim Shared theLimitButtons As aLimit
theLimitButtons.Minimum = 0
theLimitButtons.Current = theLimitButtons.Minimum
theLimitButtons.Maximum = 0 - 1

Dim Shared theLimitCheckboxes As aLimit
theLimitCheckboxes.Minimum = 0
theLimitCheckboxes.Current = theLimitCheckboxes.Minimum
theLimitCheckboxes.Maximum = 0 - 1

Dim Shared theLimitSwitches As aLimit
theLimitSwitches.Minimum = 0
theLimitSwitches.Current = theLimitSwitches.Minimum
theLimitSwitches.Maximum = 0 - 1

Dim Shared theLimitRadiobuttons As aLimit
theLimitRadiobuttons.Minimum = 0
theLimitRadiobuttons.Current = theLimitRadiobuttons.Minimum
theLimitRadiobuttons.Maximum = 0 - 1


ReDim Shared theWindows(theLimitWindows.Current) As aWindow
ReDim Shared theIcons(theLimitIcons.Current) As anIcon
ReDim Shared theButtons(theLimitButtons.Current) As aButton
ReDim Shared theCheckboxes(theLimitCheckboxes.Current) As aCheckbox
ReDim Shared theSwitches(theLimitSwitches.Current) As aSwitch
ReDim Shared theRadiobuttons(theLimitRadiobuttons.Current) As aRadiobutton

Dim Shared theMouse As aMouse

'initWindow 300, 200, 320, 240, "Window"
initIcon 100, 100, "blank.png", "Icon 1"
initIcon 200, 100, "blank.png", "Icon 2"
initButton 100, 200, 100, 40, "Button"
initCheckbox 100, 400, 50, -1, "Checkbox"
initSwitch 200, 150, 25, 0, "Switch"
initRadiobutton 550, 100, 50, 1, -1, "Radiobutton 1"
initRadiobutton 550, 175, 50, 1, 0, "Radiobutton 2"
initRadiobutton 550, 250, 50, 1, 0, "Radiobutton 3"

Dim Shared zoneTypeClicked As String

Do
    Line (0, 0)-(_Width, _Height), _RGBA32(127, 127, 127, 255), BF

    For i1 = 0 To theLimitButtons.Current
        _PutImage (theButtons(i1).positionX, theButtons(i1).positionY), theButtons(i1).imageHandle
    Next i1

    For i2 = 0 To theLimitIcons.Current
        _PutImage (theIcons(i2).positionX, theIcons(i2).positionY), theIcons(i2).imageHandle
    Next i2

    For i3 = 0 To theLimitWindows.Current
        _PutImage (theWindows(i3).positionX, theWindows(i3).positionY), theWindows(i3).imageHandle
    Next i3

    For i4 = 0 To theLimitCheckboxes.Current
        If theCheckboxes(i4).isChecked Then
            _PutImage (theCheckboxes(i4).positionX, theCheckboxes(i4).positionY), theCheckboxes(i4).imageHandle2
        Else
            _PutImage (theCheckboxes(i4).positionX, theCheckboxes(i4).positionY), theCheckboxes(i4).imageHandle1
        End If
    Next i4

    For i5 = 0 To theLimitSwitches.Current
        If theSwitches(i5).isEnabled Then
            _PutImage (theSwitches(i5).positionX, theSwitches(i5).positionY), theSwitches(i5).imageHandle2
        Else
            _PutImage (theSwitches(i5).positionX, theSwitches(i5).positionY), theSwitches(i5).imageHandle1
        End If
    Next i5

    For i6 = 0 To theLimitRadiobuttons.Current
        If theRadiobuttons(i6).isSelected Then
            _PutImage (theRadiobuttons(i6).positionX, theRadiobuttons(i6).positionY), theRadiobuttons(i6).imageHandle2
        Else
            _PutImage (theRadiobuttons(i6).positionX, theRadiobuttons(i6).positionY), theRadiobuttons(i6).imageHandle1
        End If
    Next i6

    probeMouse

    If theMouse.buttonLeft Then

        For i = 0 To theLimitWindows.Current
            Status1 = isZone~&(i, "window")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "window"
                GoTo skip
            End If
        Next i

        For i = 0 To theLimitIcons.Current
            Status1 = isZone~&(i, "icon")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "icon"
                GoTo skip
            End If
        Next i

        For i = 0 To theLimitButtons.Current
            Status1 = isZone~&(i, "button")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "button"
                GoTo skip
            End If
        Next i

        For i = 0 To theLimitCheckboxes.Current
            Status1 = isZone~&(i, "checkbox")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "checkbox"
                GoTo skip
            End If
        Next i

        For i = 0 To theLimitSwitches.Current
            Status1 = isZone~&(i, "switch")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "switch"
                GoTo skip
            End If
        Next i

        For i = 0 To theLimitRadiobuttons.Current
            Status1 = isZone~&(i, "radiobutton")
            If Status1 <> 0 Then
                status2 = Status1
                zoneTypeClicked = "radiobutton"
            End If
        Next i

        skip:

        zoneTypeClicked = LCase$(LTrim$(RTrim$(zoneTypeClicked)))

        Select Case zoneTypeClicked
            Case "window"
            Case "icon"
            Case "button"
            Case "checkbox"
                If theCheckboxes(status2).isChecked = -1 Then
                    theCheckboxes(status2).isChecked = 0
                Else
                    theCheckboxes(status2).isChecked = -1
                End If
            Case "switch"
                If theSwitches(status2).isEnabled = -1 Then
                    theSwitches(status2).isEnabled = 0
                Else
                    theSwitches(status2).isEnabled = -1
                End If
            Case "radiobutton"
                For i = 0 To theLimitRadiobuttons.Current
                    If theRadiobuttons(i).groupID = theRadiobuttons(status2).groupID Then
                        theRadiobuttons(i).isSelected = 0
                    End If
                Next i
                theRadiobuttons(status2).isSelected = -1
        End Select
    End If

    _Display

Loop Until Len(InKey$)


Sub initWindow (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inTitle As String)
    theLimitWindows.Current = theLimitWindows.Current + 1
    ReDim _Preserve theWindows(theLimitWindows.Current) As aWindow
    theWindows(theLimitWindows.Current).positionX = inPositionX
    theWindows(theLimitWindows.Current).positionY = inPositionY
    theWindows(theLimitWindows.Current).sizeX = inSizeX
    theWindows(theLimitWindows.Current).sizeY = inSizeY
    theWindows(theLimitWindows.Current).Text = inTitle
    theWindows(theLimitWindows.Current).imageHandle = _NewImage(theWindows(theLimitWindows.Current).sizeX, theWindows(theLimitWindows.Current).sizeY, 32)
    _Dest theWindows(theLimitWindows.Current).imageHandle
    _PrintMode _KeepBackground
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(191, 191, 191, 255), BF
    _PrintString (10, 10), theWindows(theLimitWindows.Current).Text
    _Dest 0
End Sub

Sub initIcon (inPositionX As Integer, inPositionY As Integer, inIconFilename As String, inIconText As String)
    theLimitIcons.Current = theLimitIcons.Current + 1
    ReDim _Preserve theIcons(theLimitIcons.Current) As anIcon
    theIcons(theLimitIcons.Current).imageHandle = _LoadImage(inIconFilename)
    theIcons(theLimitIcons.Current).positionX = inPositionX
    theIcons(theLimitIcons.Current).positionY = inPositionY
    theIcons(theLimitIcons.Current).sizeX = _Width(theIcons(theLimitIcons.Current).imageHandle)
    theIcons(theLimitIcons.Current).sizeY = _Height(theIcons(theLimitIcons.Current).imageHandle)
    theIcons(theLimitIcons.Current).Text = inIconText
End Sub

Sub initButton (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inText As String)
    theLimitButtons.Current = theLimitButtons.Current + 1
    ReDim _Preserve theButtons(theLimitButtons.Current) As aButton
    theButtons(theLimitButtons.Current).positionX = inPositionX
    theButtons(theLimitButtons.Current).positionY = inPositionY
    theButtons(theLimitButtons.Current).sizeX = inSizeX
    theButtons(theLimitButtons.Current).sizeY = inSizeY
    theButtons(theLimitButtons.Current).Text = inText
    theButtons(theLimitButtons.Current).imageHandle = _NewImage(theButtons(theLimitButtons.Current).sizeX, theButtons(theLimitButtons.Current).sizeY, 32)
    _Dest theButtons(theLimitButtons.Current).imageHandle
    _PrintMode _KeepBackground
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 0, 255, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    _PrintString (5, 5), theButtons(theLimitButtons.Current).Text
    _Dest 0
End Sub

Sub initCheckbox (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inIsChecked As _Byte, inText As String)
    theLimitCheckboxes.Current = theLimitCheckboxes.Current + 1
    ReDim _Preserve theCheckboxes(theLimitCheckboxes.Current) As aCheckbox
    theCheckboxes(theLimitCheckboxes.Current).positionX = inPositionX
    theCheckboxes(theLimitCheckboxes.Current).positionY = inPositionY
    theCheckboxes(theLimitCheckboxes.Current).sizeX = inSize
    theCheckboxes(theLimitCheckboxes.Current).sizeY = inSize
    theCheckboxes(theLimitCheckboxes.Current).isChecked = inIsChecked
    theCheckboxes(theLimitCheckboxes.Current).Text = inText
    theCheckboxes(theLimitCheckboxes.Current).imageHandle1 = _NewImage(theCheckboxes(theLimitCheckboxes.Current).sizeX, theCheckboxes(theLimitCheckboxes.Current).sizeY, 32)
    theCheckboxes(theLimitCheckboxes.Current).imageHandle2 = _NewImage(theCheckboxes(theLimitCheckboxes.Current).sizeX, theCheckboxes(theLimitCheckboxes.Current).sizeY, 32)
    _Dest theCheckboxes(theLimitCheckboxes.Current).imageHandle2
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255)
    Line (2, _Height - 3)-(_Width - 3, 2), _RGBA32(255, 255, 255, 255)
    _Dest theCheckboxes(theLimitCheckboxes.Current).imageHandle1
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    _Dest 0
End Sub

Sub initSwitch (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inIsEnabled As _Byte, inText As String)
    theLimitSwitches.Current = theLimitSwitches.Current + 1
    ReDim _Preserve theSwitches(theLimitSwitches.Current) As aSwitch
    theSwitches(theLimitSwitches.Current).positionX = inPositionX
    theSwitches(theLimitSwitches.Current).positionY = inPositionY
    theSwitches(theLimitSwitches.Current).sizeX = inSize
    theSwitches(theLimitSwitches.Current).sizeY = inSize * 2
    theSwitches(theLimitSwitches.Current).isEnabled = inIsEnabled
    theSwitches(theLimitSwitches.Current).Text = inText
    theSwitches(theLimitSwitches.Current).imageHandle1 = _NewImage(theSwitches(theLimitSwitches.Current).sizeX, theSwitches(theLimitSwitches.Current).sizeY, 32)
    theSwitches(theLimitSwitches.Current).imageHandle2 = _NewImage(theSwitches(theLimitSwitches.Current).sizeX, theSwitches(theLimitSwitches.Current).sizeY, 32)
    _Dest theSwitches(theLimitSwitches.Current).imageHandle2
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, 2)-(_Width - 3, _Height / 2), _RGBA32(255, 255, 255, 255), BF
    _Dest theSwitches(theLimitSwitches.Current).imageHandle1
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 0, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, _Height / 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255), BF
    _Dest 0
End Sub

Sub initRadiobutton (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inGroupID As _Unsigned Integer, inIsSelected As _Byte, inText As String)
    theLimitRadiobuttons.Current = theLimitRadiobuttons.Current + 1
    ReDim _Preserve theRadiobuttons(theLimitRadiobuttons.Current) As aRadiobutton
    theRadiobuttons(theLimitRadiobuttons.Current).positionX = inPositionX
    theRadiobuttons(theLimitRadiobuttons.Current).positionY = inPositionY
    theRadiobuttons(theLimitRadiobuttons.Current).sizeX = inSize
    theRadiobuttons(theLimitRadiobuttons.Current).sizeY = inSize
    theRadiobuttons(theLimitRadiobuttons.Current).groupID = inGroupID
    theRadiobuttons(theLimitRadiobuttons.Current).isSelected = inIsSelected
    theRadiobuttons(theLimitRadiobuttons.Current).Text = inText
    theRadiobuttons(theLimitRadiobuttons.Current).imageHandle1 = _NewImage(theRadiobuttons(theLimitRadiobuttons.Current).sizeX, theRadiobuttons(theLimitCheckboxes.Current).sizeY, 32)
    theRadiobuttons(theLimitRadiobuttons.Current).imageHandle2 = _NewImage(theRadiobuttons(theLimitRadiobuttons.Current).sizeX, theRadiobuttons(theLimitCheckboxes.Current).sizeY, 32)
    _Dest theRadiobuttons(theLimitRadiobuttons.Current).imageHandle2
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 255, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    Line (2, 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255)
    Line (2, _Height - 3)-(_Width - 3, 2), _RGBA32(255, 255, 255, 255)
    _Dest theRadiobuttons(theLimitRadiobuttons.Current).imageHandle1
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 255, 255), BF
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
    _Dest 0
End Sub

Sub probeMouse
    While _MouseInput
    Wend
    theMouse.positionX = _MouseX
    theMouse.positionY = _MouseY
    theMouse.buttonLeft = _MouseButton(1)
    theMouse.buttonRight = _MouseButton(2)
    theMouse.buttonMiddle = _MouseButton(3)
End Sub

Function isZone~& (inIdentifier As _Unsigned _Integer64, inSelector As String)
    inSelector = LCase$(LTrim$(RTrim$(inSelector)))
    Select Case inSelector
        Case "window"
            If theMouse.positionX >= theWindows(inIdentifier).positionX Then
                If theMouse.positionY >= theWindows(inIdentifier).positionY Then
                    If theMouse.positionX <= theWindows(inIdentifier).positionX + theWindows(inIdentifier).sizeX Then
                        If theMouse.positionY <= theWindows(inIdentifier).positionY + theWindows(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "icon"
            If theMouse.positionX >= theIcons(inIdentifier).positionX Then
                If theMouse.positionY >= theIcons(inIdentifier).positionY Then
                    If theMouse.positionX <= theIcons(inIdentifier).positionX + theIcons(inIdentifier).sizeX Then
                        If theMouse.positionY <= theIcons(inIdentifier).positionY + theIcons(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "button"
            If theMouse.positionX >= theButtons(inIdentifier).positionX Then
                If theMouse.positionY >= theButtons(inIdentifier).positionY Then
                    If theMouse.positionX <= theButtons(inIdentifier).positionX + theButtons(inIdentifier).sizeX Then
                        If theMouse.positionY <= theButtons(inIdentifier).positionY + theButtons(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "checkbox"
            If theMouse.positionX >= theCheckboxes(inIdentifier).positionX Then
                If theMouse.positionY >= theCheckboxes(inIdentifier).positionY Then
                    If theMouse.positionX <= theCheckboxes(inIdentifier).positionX + theCheckboxes(inIdentifier).sizeX Then
                        If theMouse.positionY <= theCheckboxes(inIdentifier).positionY + theCheckboxes(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "switch"
            If theMouse.positionX >= theSwitches(inIdentifier).positionX Then
                If theMouse.positionY >= theSwitches(inIdentifier).positionY Then
                    If theMouse.positionX <= theSwitches(inIdentifier).positionX + theSwitches(inIdentifier).sizeX Then
                        If theMouse.positionY <= theSwitches(inIdentifier).positionY + theSwitches(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
        Case "radiobutton"
            If theMouse.positionX >= theRadiobuttons(inIdentifier).positionX Then
                If theMouse.positionY >= theRadiobuttons(inIdentifier).positionY Then
                    If theMouse.positionX <= theRadiobuttons(inIdentifier).positionX + theRadiobuttons(inIdentifier).sizeX Then
                        If theMouse.positionY <= theRadiobuttons(inIdentifier).positionY + theRadiobuttons(inIdentifier).sizeY Then
                            isZone~& = inIdentifier
                        End If
                    End If
                End If
            End If
    End Select
End Function

Print this item

  To any sound gurus around...
Posted by: Pete - 04-19-2022, 04:36 PM - Forum: Help Me! - Replies (2)

I'm working on converting TheBOB's KONG2.BAS project to QB64. It just requires a mouse-over, but there is a sound glitch. Illegal function call.


[Image: Screenshot-552.png]



Rather than take the time to repost everything here, I'll provide a link: https://www.tapatalk.com/groups/qbasic/0...ml#p213984

There is a zip file in the last post, with all the sound files and graphics libraries. Just compile the KONG2.bas file and run. When the banana hits an object, it will error out. Hit continue, and it will continue, until the next sound channel conflict is encountered.

Thanks,

Pete

Print this item

  Keybone's GUI (Ancient QB64.net version)
Posted by: Keybone - 04-19-2022, 04:05 PM - Forum: Keybone - No Replies

I made this version of the GUI when I was first starting programming (probably 2013/2014).
It draws a group of Win 3.x lookalike windows on screen. There is no input functionality included.

Obligatory screenshot:

[Image: just-drawn.png]


Installation:
1) Copy Win31.bas and Clouds.bmp into your qb64 folder
2) Compile and run Win31.bas


Clouds.bmp:

[Image: Clouds.png]


Win31.bas:

Code: (Select All)
Type window
    windowStartX As _Unsigned Integer
    windowStartY As _Unsigned Integer
    windowSize As _Unsigned Integer
    windowAspectSelector As _Unsigned _Byte
    windowTypeSelector As _Unsigned _Byte
    windowParent As _Unsigned _Byte
    windowActive As _Unsigned _Byte
End Type

Type button
    buttonStartX As _Unsigned Integer
    buttonStartY As _Unsigned Integer
    buttonSize As _Unsigned Integer
    buttonAspectSelector As _Unsigned _Byte
    buttonTypeSelector As _Unsigned _Byte
    buttonPressed As _Unsigned _Byte
End Type

Dim Shared blackColor As _Unsigned Long
blackColor = _RGBA32(0, 0, 0, 255)

Dim Shared shadowColor As _Unsigned Long
shadowColor = _RGBA32(100, 100, 100, 255)

Dim Shared faceColor As _Unsigned Long
faceColor = _RGBA32(150, 150, 150, 255)

Dim Shared highlightColor As _Unsigned Long
highlightColor = _RGBA32(190, 190, 190, 255)

Dim Shared whiteColor As _Unsigned Long
whiteColor = _RGBA32(255, 255, 255, 255)

Dim Shared activeTitlebarColor As _Unsigned Long
activeTitlebarColor = _RGBA32(0, 0, 255, 255)

Dim Shared inactiveTitlebarColor As _Unsigned Long
inactiveTitlebarColor = _RGBA32(0, 0, 255, 255)

Dim Shared borderColor As _Unsigned Long
borderColor = _RGBA32(0, 127, 63, 255)

Dim Shared windowForegroundColor As _Unsigned Long
windowForegroundColor = _RGBA32(0, 127, 255, 255)

Dim Shared windowBackgroundColor As _Unsigned Long
windowBackgroundColor = _RGBA32(192, 192, 192, 255)

Dim Shared windowFrameColor As _Unsigned Long
windowFrameColor = _RGBA32(0, 255, 255, 255)

Dim Shared desktopColor As _Unsigned Long
desktopColor = _RGBA32(0, 0, 0, 255)

Screen _NewImage(800, 600, 32)
_PrintMode _KeepBackground
'_FullScreen

Dim Shared wallpaper As String
Dim Shared wallpaperUsed As _Bit
wallpaper = "Clouds.bmp"
wallpaperUsed = -1

Dim Shared maxWindow
maxWindow = 25
Dim Shared windows(maxWindow) As window

Dim Shared maxButton
maxButton = 500
Dim Shared buttons(maxButton) As button

Dim Shared currentWindows
Dim Shared currentButtons

Dim Shared firstAvailableWindow
Dim Shared firstAvailableButton

Dim Shared wSX: Dim Shared bSX
Dim Shared wSY: Dim Shared bSY
Dim Shared wS: Dim Shared bS
Dim Shared wAS: Dim Shared bAS
Dim Shared wT: Dim Shared bT
Dim Shared wA: Dim Shared bP
Dim Shared wP

'
' User Code Below
'
desktopDraw

Call putWindow(100, 100, 480, 1, 0, 1, 0)
Call putWindow(400, 200, 320, 0, 0, 0, 0)
Call putWindow(800, 384, 240, 1, 1, 0, 1)
Call putButton(150, 150, 30, 1, 0, 0)
Call putButton(150, 190, 30, 1, 0, 0)
Call putButton(520, 475, 30, 1, 0, 0)

Call getWindow(0)
Call windowDraw

Call getWindow(1)
Call windowDraw

Call getWindow(2)
Call windowDraw

Call getButton(0)
Call buttonDraw

Call getButton(1)
Call buttonDraw

Call getButton(2)
Call buttonDraw

Sleep

'
' User Code Above
'

Sub desktopDraw
    If wallpaperUsed = -1 Then
        image& = _LoadImage(wallpaper)
        _PutImage , image&
    Else
        Line (0, 0)-(1365, 767), desktopColor, BF
    End If
End Sub

Sub windowDraw
    Call displayWindow(wSX, wSY, wS, wAS, wT, wP, wA)
End Sub

Sub buttonDraw
    Call displayButton(bSX, bSY, bS, bAS, bT, bP)
End Sub

Sub putWindow (windowStartX, windowStartY, windowSize, windowAspectSelector, windowTypeSelector, windowParent, windowActive)

    If firstAvailableWindow <= maxWindow Then
        windows(firstAvailableWindow).windowStartX = windowStartX
        windows(firstAvailableWindow).windowStartY = windowStartY
        windows(firstAvailableWindow).windowSize = windowSize
        windows(firstAvailableWindow).windowAspectSelector = windowAspectSelector
        windows(firstAvailableWindow).windowTypeSelector = windowTypeSelector
        windows(firstAvailableWindow).windowParent = windowParent
        windows(firstAvailableWindow).windowActive = windowActive
        If firstAvailableWindow < maxWindow Then firstAvailableWindow = firstAvailableWindow + 1
        If firstAvailableWindow < maxWindow Then currentWindows = currentWindows + 1
    Else
        Rem Abort
    End If

End Sub

Sub putButton (buttonStartX, buttonStartY, buttonSize, buttonAspectSelector, buttonTypeSelector, buttonPressed)

    If firstAvailableButton <= maxButton Then
        buttons(firstAvailableButton).buttonStartX = buttonStartX
        buttons(firstAvailableButton).buttonStartY = buttonStartY
        buttons(firstAvailableButton).buttonSize = buttonSize
        buttons(firstAvailableButton).buttonAspectSelector = buttonAspectSelector
        buttons(firstAvailableButton).buttonTypeSelector = buttonTypeSelector
        buttons(firstAvailableButton).buttonPressed = buttonPressed
        If firstAvailableButton < maxButton Then firstAvailableButton = firstAvailableButton + 1
        If firstAvailableButton < maxButton Then currentButtons = currentButtons + 1
    Else
        Rem Abort
    End If

End Sub

Sub removeWindow (windowNumber)
    windows(windowNumber).windowStartX = 0
    windows(windowNumber).windowStartY = 0
    windows(windowNumber).windowSize = 0
    windows(windowNumber).windowAspectSelector = 0
    windows(windowNumber).windowTypeSelector = 0
    windows(windowNumber).windowParent = 0
    windows(windowNumber).windowActive = 0
End Sub

Sub removeButton (buttonNumber)
    buttons(buttonNumber).buttonStartX = 0
    buttons(buttonNumber).buttonStartY = 0
    buttons(buttonNumber).buttonSize = 0
    buttons(buttonNumber).buttonAspectSelector = 0
    buttons(buttonNumber).buttonTypeSelector = 0
    buttons(buttonNumber).buttonPressed = 0
End Sub

Sub getWindow (windowNumber)
    wSX = windows(windowNumber).windowStartX
    wSY = windows(windowNumber).windowStartY
    wS = windows(windowNumber).windowSize
    wAS = windows(windowNumber).windowAspectSelector
    wT = windows(windowNumber).windowTypeSelector
    wP = windows(windowNumber).windowParent
    wA = windows(windowNumber).windowActive
End Sub

Sub getButton (buttonNumber)
    bSX = buttons(buttonNumber).buttonStartX
    bSY = buttons(buttonNumber).buttonStartY
    bS = buttons(buttonNumber).buttonSize
    bAS = buttons(buttonNumber).buttonAspectSelector
    bT = buttons(buttonNumber).buttonTypeSelector
    bA = buttons(buttonNumber).buttonPressed
End Sub

Sub displayWindow (windowStartX, windowStartY, windowSize, windowAspectSelector, windowType, windowParent, windowActive)

    Dim windowAspect As _Float

    If windowAspectSelector = 0 Then
        windowAspect = 1 / 1
    Else If windowAspectSelector = 1 Then
            windowAspect = 4 / 3
        Else If windowAspectSelector = 2 Then
                windowAspect = 16 / 9
            End If
        End If
    End If

    windowEndX = windowStartX + (windowAspect * windowSize)
    windowEndY = windowStartY + windowSize

    Dim shadowDepth As _Unsigned Integer
    shadowDepth = 7

    If windowType = 0 Then
        If windowParent = 0 Then
            If windowActive = 0 Then
                Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
                Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
                Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
                Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
                Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
                Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 4, 0)
                Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
                Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
                Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), inactiveTitlebarColor, BF
                Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
            Else
                Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
                Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
                Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
                Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
                Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
                Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 4, 0)
                Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
                Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
                Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), activeTitlebarColor, BF
                Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
            End If
        Else
            If windowActive = 0 Then
                Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
                Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
                Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
                Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
                Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
                Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 3, 0)
                Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
                Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
                Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), inactiveTitlebarColor, BF
                Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
            Else
                Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
                Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
                Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
                Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
                Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
                Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 3, 0)
                Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
                Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
                Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), activeTitlebarColor, BF
                Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
            End If
        End If
    Else
        If windowType = 1 Then
            If windowParent = 1 Then
                If windowActive = 0 Then
                    Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                    Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                    Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), inactiveTitlebarColor, B
                    Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), inactiveTitlebarColor, B
                    Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), inactiveTitlebarColor, B
                    Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), inactiveTitlebarColor, B
                    Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
                    Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), inactiveTitlebarColor, BF
                    Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
                    Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 4, 0)
                    Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
                Else
                    Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                    Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                    Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), activeTitlebarColor, B
                    Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), activeTitlebarColor, B
                    Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), activeTitlebarColor, B
                    Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), activeTitlebarColor, B
                    Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
                    Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), activeTitlebarColor, BF
                    Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
                    Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 4, 0)
                    Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
                End If
            Else
                If windowActive = 0 Then
                    Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                    Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                    Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), inactiveTitlebarColor, B
                    Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), inactiveTitlebarColor, B
                    Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), inactiveTitlebarColor, B
                    Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), inactiveTitlebarColor, B
                    Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
                    Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), inactiveTitlebarColor, BF
                    Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
                    Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 3, 0)
                    Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
                Else
                    Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
                    Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
                    Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), activeTitlebarColor, B
                    Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), activeTitlebarColor, B
                    Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), activeTitlebarColor, B
                    Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), activeTitlebarColor, B
                    Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
                    Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), activeTitlebarColor, BF
                    Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
                    Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
                    Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 3, 0)
                    Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
                End If
            End If
        End If
    End If
End Sub

Sub displayButton (buttonStartX, buttonStartY, buttonSize, buttonAspectSelector, buttonType, buttonPressed)

    Dim buttonAspect As _Float

    If buttonAspectSelector = 0 Then
        buttonAspect = 1 / 1
    Else If buttonAspectSelector = 1 Then
            buttonAspect = 70 / 23
        End If
    End If

    buttonEndX = buttonStartX + (buttonAspect * buttonSize)
    buttonEndY = buttonStartY + buttonSize

    If buttonType = 0 Then
        If buttonPressed = 0 Then
            Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), shadowColor, B
            Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), highlightColor, B
            Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
        End If
        If buttonPressed = 1 Then
            Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), highlightColor, B
            Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), shadowColor, B
            Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
        End If
    End If

    If buttonType = 1 Then
        If buttonPressed = 0 Then
            Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), shadowColor, B
            Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), highlightColor, B
            Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
        End If
        If buttonPressed = 1 Then
            Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), highlightColor, B
            Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), shadowColor, B
            Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
        End If
        Line (buttonStartX + 5, buttonStartY + 7)-(buttonStartX + 11, buttonStartY + 7), blackColor
        Line (buttonStartX + 6, buttonStartY + 8)-(buttonStartX + 10, buttonStartY + 8), blackColor
        Line (buttonStartX + 7, buttonStartY + 9)-(buttonStartX + 9, buttonStartY + 9), blackColor
        Line (buttonStartX + 8, buttonStartY + 10)-(buttonStartX + 8, buttonStartY + 10), blackColor

    End If

    If buttonType = 2 Then
        If buttonPressed = 0 Then
            Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), shadowColor, B
            Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), highlightColor, B
            Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
        End If
        If buttonPressed = 1 Then
            Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), highlightColor, B
            Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
            Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), shadowColor, B
            Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
        End If
        Line (buttonStartX + 8, buttonStartY + 6)-(buttonStartX + 8, buttonStartY + 6), blackColor
        Line (buttonStartX + 7, buttonStartY + 7)-(buttonStartX + 9, buttonStartY + 7), blackColor
        Line (buttonStartX + 6, buttonStartY + 8)-(buttonStartX + 10, buttonStartY + 8), blackColor
        Line (buttonStartX + 5, buttonStartY + 9)-(buttonStartX + 11, buttonStartY + 9), blackColor
    End If

    If buttonType = 3 Then
        Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), faceColor, BF
        Line (buttonStartX + 1, buttonStartY + 1)-(buttonStartX + 18, buttonStartY + 18), surfColor, BF
        Line (buttonStartX + 3, buttonStartY + 9)-(buttonStartX + 16, buttonStartY + 11), shadColor, B
        Line (buttonStartX + 2, buttonStartY + 8)-(buttonStartX + 15, buttonStartY + 10), blackColor, B
        Line (buttonStartX + 3, buttonStartY + 9)-(buttonStartX + 14, buttonStartY + 9), whiteColor
    End If

    If buttonType = 4 Then
        Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), faceColor, BF
        Line (buttonStartX + 1, buttonStartY + 1)-(buttonStartX + 18, buttonStartY + 18), surfColor, BF
        Line (buttonStartX + 6, buttonStartY + 9)-(buttonStartX + 11, buttonStartY + 11), shadColor, B
        Line (buttonStartX + 5, buttonStartY + 8)-(buttonStartX + 12, buttonStartY + 10), blackColor, B
        Line (buttonStartX + 6, buttonStartY + 9)-(buttonStartX + 11, buttonStartY + 9), whiteColor
    End If
End Sub

Sub displayIcon (iconImagePath$, iconTitle$, iconStartX, iconStartY, iconSize, iconAspect, iconSelected)
    Print "icon"
End Sub

Print this item

  Downloading an attachment problem
Posted by: Richard - 04-19-2022, 03:34 PM - Forum: General Discussion - Replies (8)

I just tried to download a .zip and got this message (attachment) instead



Attached Files Thumbnail(s)
   
Print this item

  Keybone's GUI (04/07/2022)
Posted by: Keybone - 04-19-2022, 02:42 PM - Forum: Keybone - Replies (6)

This is the latest rewrite of my GUI.
It is not complete by any means, as always work-in-progress.

What's working:
Restore window from Icon
Move window
Move Icon
Minimize window to icon
Maximize window to screen size

Not working:
Restore window from maximized
Minimize window from maximized
Close window
Z-order focus (windows do not rise to the top of z-order when clicked (yet).)

Also, unlike some of my previous versions, there is no background implemented yet.

Here for the obligatory screenshots:

All windows minimized:
[Image: allminimized.png]


One window restored from minimized:

[Image: one-restored.png]


Window resizing:

[Image: resizing.png]


Window resized (and z-order bug):

[Image: resized-zorderni.png]


Window maximized (and z-order bug):

[Image: maximized.png]

Installing:
Copy and paste k-win-upload.bas and blank.png into your qb64 folder. Compile and run k-win-upload.bas.

blank.png :

[Image: blank.png]


k-win-upload.bas :

Code: (Select All)
Type aSize
    restoredSizeX As _Unsigned Integer
    restoredSizeY As _Unsigned Integer
    maximizedSizeX As _Unsigned Integer
    maximizedSizeY As _Unsigned Integer
End Type

Type aProperty
    isMinimizable As _Byte
    isRestorable As _Byte
    isMaximizable As _Byte
    isMovable As _Byte
    isResizable As _Byte
End Type

Type aStatus
    isMinimized As _Byte
    isRestored As _Byte
    isMaximized As _Byte
    isMoving As _Byte
    isResizing As _Byte
End Type

Type aWindow
    positionX As Integer
    positionY As Integer
    Size As aSize
    restoredImageHandle As _Unsigned Long
    maximizedImageHandle As _Unsigned Long
    Properties As aProperty
    Status As aStatus
    isActive As _Byte
End Type

Type anIcon
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    imageHandle As _Unsigned Long
End Type

Type anObject
    Title As String
    Identifier As String
    Windows As aWindow
    Icons As anIcon
End Type

Type aMouse
    positionX As Integer
    positionY As Integer
    buttonLeft As _Byte
    buttonCenter As _Byte
    buttonRight As _Byte
End Type

Type aZone
    parentIdentifier As _Unsigned Integer
    Identifier As _Unsigned Integer
    positionX As Integer
    positionY As Integer
    sizeX As _Unsigned Integer
    sizeY As _Unsigned Integer
    Purpose As String
End Type

Type aLimit
    Minimum As _Unsigned Integer
    Current As _Unsigned Integer
    Maximum As _Unsigned Integer
End Type

Dim Shared limitObjects As aLimit
limitObjects.Minimum = 0
limitObjects.Current = limitObjects.Minimum
limitObjects.Maximum = 0 - 1

Dim Shared limitZones As aLimit
limitZones.Minimum = 0
limitZones.Current = limitZones.Minimum
limitZones.Maximum = 0 - 1

ReDim Shared Objects(limitObjects.Current) As anObject
ReDim Shared Zones(limitZones.Current) As aZone

Dim Shared ZoneMatched As _Unsigned Integer
Dim Shared WindowMatched As _Unsigned Integer
Dim Shared Purpose As String

Dim Shared Mouse As aMouse

' BAS on down BI on up

Screen _NewImage(800, 600, 32)
'_FullScreen _SquarePixels

Dim Shared gray25 As _Unsigned Long: gray25 = _RGBA32(63, 63, 63, 255)
Dim Shared gray50 As _Unsigned Long: gray50 = _RGBA32(127, 127, 127, 255)
Dim Shared gray75 As _Unsigned Long: gray75 = _RGBA32(191, 191, 191, 255)

objectInit 100, 100, 200, 200, "Window 1", "Window Title 1"
'objectDisableMaximization limitObjects.Current

objectInit 200, 200, 200, 200, "Window 2", "Window Title 2"
'objectDisableMaximization limitObjects.Current

objectInit 300, 300, 200, 200, "Window 3", "Window Title 3"
'objectDisableMaximization limitObjects.Current

Do
    Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF

    For i = 0 To limitObjects.Current
        If Objects(i).Windows.Status.isMinimized Then
            _PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
        ElseIf Objects(i).Windows.Status.isRestored Then
            _PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
        ElseIf Objects(i).Windows.Status.isMaximized Then
            _PutImage (0, 0), Objects(i).Windows.maximizedImageHandle
        End If
    Next i

    mouseProbe

    If Mouse.buttonLeft Then
        For i = 0 To limitObjects.Current
            WindowMatched = isObject~%(i)
            If WindowMatched Then
                If Objects(WindowMatched).Windows.Status.isMinimized Then
                    _Delay .125
                    mouseProbe
                    If Mouse.buttonLeft Then
                        objectMove WindowMatched
                    Else
                        objectRestore WindowMatched
                    End If
                ElseIf Objects(WindowMatched).Windows.Status.isRestored Then
                    If Mouse.positionX > Objects(WindowMatched).Windows.positionX + 4 And Mouse.positionX < Objects(WindowMatched).Windows.positionX + 24 Then
                        If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
                            ' Close
                        End If
                    End If
                    If Mouse.positionX > Objects(WindowMatched).Windows.positionX + 24 And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 69) Then
                        If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
                            objectMove WindowMatched
                        End If
                    End If
                    If Mouse.positionX > Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 46) And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 23) Then
                        If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
                            objectMinimize WindowMatched
                        End If
                    End If
                    If Mouse.positionX > Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 23) And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 3) Then
                        If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
                            objectMaximize WindowMatched
                        End If
                    End If
                    If Mouse.positionX > Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 23) And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 3) Then
                        If Mouse.positionY > Objects(WindowMatched).Windows.positionY + (_Height(Objects(WindowMatched).Windows.restoredImageHandle) - 23) And Mouse.positionY < Objects(WindowMatched).Windows.positionY + (_Height(Objects(WindowMatched).Windows.restoredImageHandle) - 3) Then
                            objectResize WindowMatched
                        End If
                    End If
                End If
            End If
        Next i
    End If
    _Limit 60
    _Display
Loop Until Len(InKey$)

Sub objectAdd
    limitObjects.Current = limitObjects.Current + 1
    ReDim _Preserve Objects(limitObjects.Current) As anObject
End Sub

Sub objectRemove (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Icons.imageHandle Then
        _FreeImage Objects(inIdentifier).Icons.imageHandle
    End If
    If Objects(inIdentifier).Windows.restoredImageHandle Then
        _FreeImage Objects(inIdentifier).Windows.restoredImageHandle
    End If
    If Objects(inIdentifier).Windows.maximizedImageHandle Then
        _FreeImage Objects(inIdentifier).Windows.maximizedImageHandle
    End If
    For i = inIdentifier To limitObjects.Current - 1 Step 1
        Objects(i) = Objects(i + 1)
    Next i

    If limitObjects.Current > limitObjects.Minimum Then ' redim array
        limitObjects.Current = limitObjects.Current - 1
        ReDim _Preserve Objects(limitObjects.Current) As anObject
    End If
End Sub

Sub objectInit (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inIdentifier As String, inTitle As String)
    objectAdd
    Objects(limitObjects.Current).Title = inTitle
    Objects(limitObjects.Current).Identifier = inIdentifier
    Objects(limitObjects.Current).Windows.positionX = inPositionX
    Objects(limitObjects.Current).Windows.positionY = inPositionY
    Objects(limitObjects.Current).Windows.Size.restoredSizeX = inSizeX
    Objects(limitObjects.Current).Windows.Size.restoredSizeY = inSizeY
    Objects(limitObjects.Current).Windows.Size.maximizedSizeX = _Width
    Objects(limitObjects.Current).Windows.Size.maximizedSizeY = _Height
    Objects(limitObjects.Current).Windows.restoredImageHandle = _NewImage(Objects(limitObjects.Current).Windows.Size.restoredSizeX, Objects(limitObjects.Current).Windows.Size.restoredSizeY, 32)
    Objects(limitObjects.Current).Windows.maximizedImageHandle = _NewImage(Objects(limitObjects.Current).Windows.Size.maximizedSizeX, Objects(limitObjects.Current).Windows.Size.maximizedSizeY, 32)
    Objects(limitObjects.Current).Windows.Properties.isMinimizable = -1
    Objects(limitObjects.Current).Windows.Properties.isRestorable = -1
    Objects(limitObjects.Current).Windows.Properties.isMaximizable = -1
    Objects(limitObjects.Current).Windows.Properties.isMovable = -1
    Objects(limitObjects.Current).Windows.Properties.isResizable = -1
    Objects(limitObjects.Current).Windows.Status.isMinimized = -1
    Objects(limitObjects.Current).Windows.Status.isRestored = 0
    Objects(limitObjects.Current).Windows.Status.isMaximized = 0
    Objects(limitObjects.Current).Windows.Status.isMoving = 0
    Objects(limitObjects.Current).Windows.Status.isResizing = 0
    Objects(limitObjects.Current).Windows.isActive = 0
    Objects(limitObjects.Current).Icons.positionX = Objects(limitObjects.Current).Windows.positionX + (Objects(limitObjects.Current).Windows.Size.restoredSizeX / 2)
    Objects(limitObjects.Current).Icons.positionY = Objects(limitObjects.Current).Windows.positionY + (Objects(limitObjects.Current).Windows.Size.restoredSizeY / 2)
    Objects(limitObjects.Current).Icons.imageHandle = _LoadImage("blank.png")
    Objects(limitObjects.Current).Icons.sizeX = _Width(Objects(limitObjects.Current).Icons.imageHandle)
    Objects(limitObjects.Current).Icons.sizeY = _Height(Objects(limitObjects.Current).Icons.imageHandle)
    objectDraw limitObjects.Current, "Restored"
    objectDraw limitObjects.Current, "Maximized"
End Sub

Sub objectDraw (inIdentifier As _Unsigned Integer, inMode As String)
    inMode = LTrim$(RTrim$(UCase$(inMode)))
    Select Case inMode
        Case "RESTORED"
            _Dest Objects(inIdentifier).Windows.restoredImageHandle
            Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(127, 127, 127, 255), BF
            box 0, 0, _Width - 1, _Height - 1, 1
            box 0, 0, _Width - 1, _Height - 1, 1
            If Objects(Identifier).Windows.isActive = -1 Then
                Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 255, 255, 255)
            Else
                Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 127, 127, 255)
            End If
            box2 _Width - 48, 3, 20, 20, 1, 7
            box2 _Width - 25, 3, 20, 20, 1, 2
            box3 4, 3, 20, 20, 1, 1, 7
            _Dest 0
        Case "MAXIMIZED"
            _Dest Objects(inIdentifier).Windows.maximizedImageHandle
            Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(127, 127, 127, 255), BF
            box 0, 0, _Width - 1, _Height - 1, 1
            box 0, 0, _Width - 1, _Height - 1, 1
            If Objects(Identifier).Windows.isActive = -1 Then
                Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 255, 255, 255)
            Else
                Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 127, 127, 255)
            End If
            box2 _Width - 48, 3, 20, 20, 1, 7
            box2 _Width - 25, 3, 20, 20, 1, 2
            box3 4, 3, 20, 20, 1, 1, 7
            _Dest 0
    End Select
End Sub

Sub objectMinimize (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Windows.Properties.isMinimizable = -1 Then
        Objects(inIdentifier).Windows.Status.isMinimized = -1
        Objects(inIdentifier).Windows.Status.isRestored = 0
        Objects(inIdentifier).Windows.Status.isMaximized = 0
    End If
End Sub

Sub objectRestore (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Windows.Properties.isRestorable = -1 Then
        Objects(inIdentifier).Windows.Status.isMinimized = 0
        Objects(inIdentifier).Windows.Status.isRestored = -1
        Objects(inIdentifier).Windows.Status.isMaximized = 0
    End If
End Sub

Sub objectMaximize (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Windows.Properties.isMaximizable = -1 Then
        Objects(inIdentifier).Windows.Status.isMinimized = 0
        Objects(inIdentifier).Windows.Status.isRestored = 0
        Objects(inIdentifier).Windows.Status.isMaximized = -1
    End If
End Sub

Sub objectMove (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Windows.Properties.isMovable Then
        Objects(inIdentifier).Windows.Status.isMoving = -1
        Dim previousPositionX As _Unsigned Integer, previousPositionY As _Unsigned Integer
        If Objects(inIdentifier).Windows.Status.isMinimized Then
            previousPositionX = Objects(inIdentifier).Icons.positionX - Mouse.positionX
            previousPositionY = Objects(inIdentifier).Icons.positionY - Mouse.positionY
            While Mouse.buttonLeft
                Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
                mouseProbe
                Objects(inIdentifier).Icons.positionX = Mouse.positionX + previousPositionX
                Objects(inIdentifier).Icons.positionY = Mouse.positionY + previousPositionY
                For i = 1 To limitObjects.Current
                    If Objects(i).Windows.Status.isMinimized Then
                        _PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
                    ElseIf Objects(i).Windows.Status.isRestored Then
                        _PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
                    End If
                Next i
                _Display
            Wend
        ElseIf Objects(inIdentifier).Windows.Status.isRestored Then
            previousPositionX = Objects(inIdentifier).Windows.positionX - Mouse.positionX
            previousPositionY = Objects(inIdentifier).Windows.positionY - Mouse.positionY
            While Mouse.buttonLeft
                Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
                mouseProbe
                Objects(inIdentifier).Windows.positionX = Mouse.positionX + previousPositionX
                Objects(inIdentifier).Windows.positionY = Mouse.positionY + previousPositionY
                For i = 1 To limitObjects.Current
                    If Objects(i).Windows.Status.isMinimized Then
                        _PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
                    ElseIf Objects(i).Windows.Status.isRestored Then
                        _PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
                    End If
                Next i
                _Display
            Wend
        End If
        Objects(inIdentifier).Windows.Status.isMoving = 0
    End If
End Sub

Sub objectResize (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Windows.Properties.isResizable Then
        Objects(inIdentifier).Windows.Status.isResizing = -1
        Dim positionX As Integer, positionY As Integer
        Dim sizeX As _Unsigned Integer, sizeY As _Unsigned Integer
        positionX = Objects(inIdentifier).Windows.positionX
        positionY = Objects(inIdentifier).Windows.positionY
        While Mouse.buttonLeft
            Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
            mouseProbe
            For i = 1 To limitObjects.Current
                If Objects(i).Windows.Status.isMinimized Then
                    _PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
                ElseIf Objects(i).Windows.Status.isRestored Then
                    _PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
                End If
            Next i
            sizeX = (Mouse.positionX - Objects(inIdentifier).Windows.positionX)
            sizeY = (Mouse.positionY - Objects(inIdentifier).Windows.positionY)
            Line (Objects(inIdentifier).Windows.positionX, Objects(inIdentifier).Windows.positionY)-(Objects(inIdentifier).Windows.positionX + sizeX, Objects(inIdentifier).Windows.positionY + sizeY), _RGBA32(255, 255, 255, 255), B
            _Display
        Wend
        sizeX = (Mouse.positionX - Objects(inIdentifier).Windows.positionX)
        sizeY = (Mouse.positionY - Objects(inIdentifier).Windows.positionY)
        _FreeImage Objects(inIdentifier).Windows.restoredImageHandle
        Objects(indentifier).Windows.restoredImageHandle = _NewImage(sizeX, sizeY, 32)
        objectDraw inIdentifier, "Restored"
        _PutImage (positionX, positionY), inIdentifier
        Objects(inIdentifier).Windows.positionX = positionX
        Objects(inIdentifier).Windows.positionY = positionY
        Objects(inIdentifier).Windows.Size.restoredSizeX = sizeX
        Objects(inIdentifier).Windows.Size.restoredSizeY = sizeY
        Objects(inIdentifier).Windows.Status.isResizing = 0
    End If
End Sub

Sub objectDisableMinimization (inIdentifier As _Unsigned Integer)
    Objects(inIdentifier).Windows.Properties.isMinimizable = 0
End Sub

Sub objectDisableRestoration (inIdentifier As _Unsigned Integer)
    Objects(inIdentifier).Windows.Properties.isRestorable = 0
End Sub

Sub objectDisableMaximization (inIdentifier As _Unsigned Integer)
    Objects(inIdentifier).Windows.Properties.isMaximizable = 0
End Sub

Sub objectDisableMoving (inIdentifier As _Unsigned Integer)
    Objects(inIdentifier).Windows.Properties.isMovable = 0
End Sub

Sub objectDisableResizing (inIdentifier As _Unsigned Integer)
    Objects(inIdentifier).Windows.Properties.isResizable = 0
End Sub

Sub mouseProbe
    While _MouseInput
        Mouse.positionX = _MouseX
        Mouse.positionY = _MouseY
        Mouse.buttonLeft = _MouseButton(1)
        Mouse.buttonCenter = _MouseButton(3)
        Mouse.buttonRight = _MouseButton(2)
    Wend
End Sub

Function isObject~% (inIdentifier As _Unsigned Integer)
    If Objects(inIdentifier).Windows.Status.isMinimized Then
        If Mouse.positionX >= Objects(inIdentifier).Icons.positionX Then
            If Mouse.positionY >= Objects(inIdentifier).Icons.positionY Then
                If Mouse.positionX <= Objects(inIdentifier).Icons.positionX + Objects(inIdentifier).Icons.sizeX Then
                    If Mouse.positionY <= Objects(inIdentifier).Icons.positionY + Objects(inIdentifier).Icons.sizeY Then
                        isObject~% = inIdentifier
                    End If
                End If
            End If
        End If
    ElseIf Objects(inIdentifier).Windows.Status.isRestored Then
        If Mouse.positionX >= Objects(inIdentifier).Windows.positionX Then
            If Mouse.positionY >= Objects(inIdentifier).Windows.positionY Then
                If Mouse.positionX <= Objects(inIdentifier).Windows.positionX + Objects(inIdentifier).Windows.Size.restoredSizeX Then
                    If Mouse.positionY <= Objects(inIdentifier).Windows.positionY + Objects(inIdentifier).Windows.Size.restoredSizeY Then
                        isObject~% = inIdentifier
                    End If
                End If
            End If
        End If
    End If
End Function

Sub Titlebar (titlebarPositionX As _Unsigned Integer, titlebarPositionY As _Unsigned Integer, titlebarWidth As _Unsigned Integer, titlebarHeight As _Unsigned Integer, titlebarColor As _Unsigned Long)
    Line (titlebarPositionX, titlebarPositionY)-(titlebarPositionX + titlebarWidth, titlebarPositionY + titlebarHeight), titlebarColor, BF
End Sub

Sub box (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer)
    Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray75, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray25, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), gray50, BF
End Sub

Sub box2 (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer, interiorDepth As _Unsigned Integer)
    interiorDepth = interiorDepth * boxDepth
    Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray25, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray75, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), gray50, BF
    Line (boxPositionX + boxDepth + interiorDepth, boxPositionY + boxDepth + interiorDepth)-(boxPositionX + boxWidth - boxDepth - interiorDepth, boxPositionY + boxHeight - boxDepth - interiorDepth), gray75, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepth, boxPositionY + (boxDepth * 2) + interiorDepth)-(boxPositionX + boxWidth - boxDepth - interiorDepth, boxPositionY + boxHeight - boxDepth - interiorDepth), gray25, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepth, boxPositionY + (boxDepth * 2) + interiorDepth)-(boxPositionX + boxWidth - (boxDepth * 2) - interiorDepth, boxPositionY + boxHeight - (boxDepth * 2) - interiorDepth), gray50, BF
End Sub

Sub box3 (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer, interiorDepthX As _Unsigned Integer, interiorDepthY As _Unsigned Integer)
    interiorDepthX = interiorDepthX * boxDepth
    interiorDepthY = interiorDepthY * boxDepth
    Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray25, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray75, BF
    Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), gray50, BF
    Line (boxPositionX + boxDepth + interiorDepthX, boxPositionY + boxDepth + interiorDepthY)-(boxPositionX + boxWidth - boxDepth - interiorDepthX, boxPositionY + boxHeight - boxDepth - interiorDepthY), gray75, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepthX, boxPositionY + (boxDepth * 2) + interiorDepthY)-(boxPositionX + boxWidth - boxDepth - interiorDepthX, boxPositionY + boxHeight - boxDepth - interiorDepthY), gray25, BF
    Line (boxPositionX + (boxDepth * 2) + interiorDepthX, boxPositionY + (boxDepth * 2) + interiorDepthY)-(boxPositionX + boxWidth - (boxDepth * 2) - interiorDepthX, boxPositionY + boxHeight - (boxDepth * 2) - interiorDepthY), gray50, BF
End Sub

Print this item

  Last QB64 win x-64 dev download?
Posted by: Richard - 04-19-2022, 12:55 PM - Forum: General Discussion - Replies (1)

What was the last dev package?

I have 6e385df originally downloaded March 11 (but was apparently the same as that downloaded on March 30).

Print this item

  GUI..sort...of.....
Posted by: Abacus - 04-19-2022, 09:23 AM - Forum: Works in Progress - Replies (2)

Found my old code that I wrote back in 1996 on QBASIC...figured I share it.

Code: (Select All)
'old code for a GUI that I was working on back in 1996
'By: Abacus

1 Cls
2
Screen 12
3 Rem This is the main box
4 Draw "C8 BM0,0 R639 D479 L639 U479"
5 Paint (2, 2), 8, 8
6 Draw "c0 bm4,46 r630 d398 l629 u398"
7 Draw "C0 BM4,45 R631 D400 L631 U400"
8 Paint (10, 60), 7, 0
9 Draw "C0 BM5,474 R59 U24"
10 Draw "C0 BM5,450 R60 D25 L60 U25"
11 Paint (8, 455), 8, 0
12 Draw "C1 BM4,4 R631 D20 L631 U20"
13 Paint (5, 5), 1, 1
14 Draw "C0 BM4,24 R631 U20"
15 Draw "C0 BM4,23 R630 U19"

16 Rem This draws the icon face
17 Draw "c7 bm9,6 r15 d14 l15 u14"
18 Paint (10, 8), 7, 7
19 Circle (16, 13), 6, 0
20 Paint (13, 17), 14, 0
21 Circle (16, 13), 5, 0
22 PSet (13, 13), 0
23 PSet (14, 13), 0
24 PSet (18, 13), 0
25 PSet (19, 13), 0
26 Draw "c0 bm14,16 r4"

27 Rem This draws the exit box
28 Draw "c7 bm613,6 r15 d14 l15 u14"
29 Paint (614, 7), 7, 7
30 Draw "c4 bm617,8 d10 r6 l6 u5 r6 l6 u5 r6"
31 Draw "c0 bm616,9 d10 r6"
32 Draw "c0 bm618,14 r4"
33 Draw "c0 bm618,9 r4"
34 Rem This is the word OPEN
35 Draw "c0 bm8,454 r10 d15 l10 u15" 'Out line of the leter O
36 Draw "c0 bm10,457 r6 d9 l6 u9" 'In line of the leter O
37 Paint (12, 456), 4, 0
38 Draw "c0 bm21,454 r9 d8 l6 d7 l3 u14 " 'Out line of the leter P
39 Draw "c0 bm24,456 r4 d4 l4 u4" 'In line of the leter P
40 Paint (23, 459), 4, 0
41 Draw "c0 bm34,454 r9  d3 l7 d3 r7 d3 l7 d3 r7 d3 l10 u15 r2"
42 'The full leter E
43 Paint (35, 456), 4, 0
44 Draw "c0 bm46,454 r5 ta30 d10 ta0 u10 r4 d16 l4 ta40 u10 ta0 d8 l4 u14 "
45 'leter N
46 Paint (47, 455), 4, 0
47 Draw "c0 bm45,471 r16 " 'underline
48 Rem End of the word OPEN

49 Rem This is the word GUI
50 Draw "c0 bm30,6 r12 d3 l3 u1 l6 d10 r10 u4 l7 u2 r10 d9 l18 u15 r2" 'Leter G
51 Paint (31, 8), 4, 0
52 Draw "c0 bm50,6 d4 r3 d11 r16 u11 r3 u4 l10 d4 r2 d7 l6 u7 r2 u4 l10"
53 'Leter U
54 Paint (51, 8), 4, 0
55 Draw "c0 bm77,6 d4 r5 d6 l5 d5 r14 u5 l5 u6 r5 u4 l13 " 'Leter I
56 Paint (79, 7), 4, 0

57 Rem The Leters GUI on the other side
58 Draw "c0 bm547,6 r12 d3 l3 u1 l6 d10 r10 u4 l7 u2 r10 d9 l18 u15 r2" 'Leter G
59 Paint (548, 8), 4, 0
60 Draw "c0 bm567,6 d4 r3 d11 r16 u11 r3 u4 l10 d4 r2 d7 l6 u7 r2 u4 l10"
61 'Leter U
62 Paint (568, 8), 4, 0
63 Draw "c0 bm594,6 d4 r5 d6 l5 d5 r14 u5 l5 u6 r5 u4 l13 " 'Leter I
64 Paint (595, 7), 4, 0


65 Rem This is the option, about, and help list.
66 'word option
67 Draw "c15 bm30,29 r7 d10 l7 u10"
68 Draw "c15 bm40,29 r7 d5 l7 u5 d10"
69 Draw "c15 bm50,29 r8 l4 d10 "
70 Draw "c15 bm60,29 r8 l4 d10 l4 r8"
71 Draw "c15 bm70,29 r7 d10 l7 u10"
72 Draw "c15 bm81,39 u10 ta30 d11 ta0 u10"
73 Draw "c15 bm29,42 r9" 'underline

74 'word about
75 'leter A
78 Draw "c15 bm290,29 ta-20 d11 ta-20 u11 ta0 r4 ta20 d11 ta20 u6 ta0 l7"
79 ' leter B
80 Draw "c15 bm301,29 r8 d4 l8 u4 d10 r8 u10 "
81 'leter O
82 Draw "c15 bm312,29 r7 d10 l7 u10"
83 'leter U
84 Draw "c15 bm322,29 d10 r7 u10"
85 'leter T
86 Draw "c15 bm332,29 r8 l4 d10"
87 Draw "c15 bm284,42 r16 " 'underline

88 'word help
89 Draw "c15 bm525,29 d10 u5 r7 u5 d10" 'leter H
90 Draw "c15 bm535,29 d10 r5 l5 u5 r5 l5 u5 r5" 'E
91 Draw "c15 bm543,29 d10 r5" 'leter L
92 Draw "c15 bm551,29 d10 u4 r7 u6 l7" 'leter P
93 Draw "c15 bm524,42 r9"


Do
    check$ = InKey$
Loop While check$ = ""
Select Case check$
    Case Chr$(79)
        GoTo 94
    Case Chr$(111)
        GoTo 94
    Case Chr$(101)
        GoTo 200
    Case Chr$(69)
        GoTo 200
    Case Chr$(65)
        GoTo 97
    Case Chr$(97)
        GoTo 97
    Case Chr$(104)
        GoTo 104
    Case Chr$(72)
        GoTo 104
    Case Chr$(110)
        GoTo 108
    Case Chr$(78)
        GoTo 108
    Case Else
        GoTo 2
End Select

94 Rem This is the option box
95 Draw "c0 bm26,27 r70 d20 l70 u20 d300 r200 u280 l200 r201 d281 l199"
96 Paint (27, 90), 8, 0

Do
    check$ = InKey$
Loop While check$ = ""
Select Case check$
    Case Chr$(27)
        GoTo hold
    Case Else
        GoTo 94
End Select

hold:
Rem This is the option box
Draw "c7 bm26,27 r70 d20 l70 u20 d300 r200 u280 l200 r201 d281 l199"
Paint (27, 90), 7, 7
Draw "c8 bm26,27 r70 d17 u17 l70 d17"
GoTo 2


97 Rem this is the about box
99 Draw "c0 bm279,27 r70 d20 l70 u20 d140 r210 u120 l210"
100 Draw "c0 bm490,47 d121 l209"
101 Paint (281, 128), 8, 0
Do
    check$ = InKey$
Loop While check$ = ""
Select Case check$
    Case Chr$(27)
        GoTo hold2
    Case Else
        GoTo 97
End Select

hold2:
Draw "c7 bm279,27 r70 d20 l70 u20 d140 r210 u120 l210"
Draw "c7 bm490,47 d121 l209"
Paint (281, 128), 7, 7
Draw "c8 bm279,27 r70 d17 u17 l70 d17"
GoTo 2

103 Rem this is the help box
104 Draw "c8 bm519,27 r50 d20 l50 u20 d20 l150 d110 r200 u130"
107 Paint (519, 156), 8, 8
105 Draw "c0 bm519,158 l150 u111 d111 r201 u112 l1 u19 l50 d19"
106 Draw "bm521,159 l150 r200 u112"

Do
    check$ = InKey$
Loop While check$ = ""
Select Case check$
    Case Chr$(27)
        GoTo hold3
    Case Else
        GoTo 104
End Select
hold3:
Draw "c7 bm519,27 r50 d20 l50 u20 d20 l150 d110 r200 u130"
Paint (519, 156), 7, 7
Draw "c7 bm519,158 l150 u111 d111 r201 u112 l1 u19 l50 d19"
Draw " c7 bm521,159 l150 r200 u112"
Draw "c8 bm519,27 r50 d17 u17 l50 d17"
GoTo 2

108 Rem This is the open box
109 Draw "c8 bm2,450 u100 r150 d100 l150"
110 Paint (9, 438), 8, 8
111 Draw "c0 bm2,450 u100 r150 d100 l150"
112 Draw "c0 bm1,449 u100 r152 d102 l149"
Do
    check$ = InKey$
Loop While check$ = ""
Select Case check$
    Case Chr$(27)
        GoTo hold4
    Case Else
        GoTo 108
End Select
hold4:
Draw "c7 bm2,450 u100 r150 d100 l150"
Paint (9, 438), 7, 7
Draw "c7 bm2,450 u100 r150 d100 l150"
Draw "c7 bm1,449 u100 r152 d102 l149"
Draw "c8 bm1,450 u101 r2 d97 r150 d5 l89 u2 l60 d2 l2"
Paint (100, 449), 8, 8
Draw "c8 bm5,451 r60"
GoTo 2
200 End

Print this item

  Old Modem Program
Posted by: Abacus - 04-19-2022, 08:59 AM - Forum: Programs - Replies (7)

Posting an old program from my 2006 backup disk of archived files. I hope someone will find it interesting. 

Code: (Select All)
Cls
Print "Simple Qbasic communications program."
Print "What COM port does your modem use?"
Input ">", port$
baud$ = "9600" '9600 should work fine with most modems. If you have
'an older one use 2400.
'Open up that com port.
Open "COM" + port$ + ":" + baud$ + ",N,8,1,RB2048,TB2048" For Random As #1

Print "OPTIONS:"
Print "1-Dial up to another computer"
Print "2-Wait for a call"
Print "3-Quit"
Do
    a = Val(InKey$)
Loop Until a >= 1 And a <= 3
If a = 3 Then Close: System
If a = 2 Then GoTo waitfor

Print "Number to call?"
Input ">", number$
Print #1, "ATDT" + number$ 'Tell the modem to dial the number.
GoTo chat

waitfor:
Print #1, "ATS0=1" 'Tell modem to connect after 1 ring.

'When a modem connects it returns "CONNECT ####"
'The next hunk of code waits until the modem connects before moving on

a$ = ""
Do
    If Loc(1) Then a$ = a$ + Input$(1, 1) 'if anything in modem add it to a$
Loop Until InStr(a$, "CONNECT") 'Wait until modem have connected.

chat:
'If you where waiting for a call, a lot of ASCII characters will be printed
'on the screen. Don't worry, that's just the computers getting in sync and
'talking. You also will not see what you type.

Cls
Print "You are now ready to chat, press ESC to quit."
Do
    t$ = InKey$
    If Len(t$) Then Print #1, t$ 'if you typed something send it to the modem
    'this will be send by the modem to the other
    'computer
    If Loc(1) Then r$ = Input$(1, 1) 'if the is something to get, get it and save
    'it as r$
    If Len(r$) Then Print r$; 'if r$ <> "" then print it. the ";" means a
    'line is not started
Loop Until t$ = Chr$(27) 'keep doing this until ESC is pressed
Print #1, "ATZ" 'tell the modem to hang up
Close 'close the open com statement

Print this item