QB64 Phoenix Edition
a little tutorial demo for Windows in SCREEN 0 - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Official Links (https://qb64phoenix.com/forum/forumdisplay.php?fid=16)
+--- Forum: Learning Resources and Archives (https://qb64phoenix.com/forum/forumdisplay.php?fid=13)
+--- Thread: a little tutorial demo for Windows in SCREEN 0 (/showthread.php?tid=3264)



a little tutorial demo for Windows in SCREEN 0 - TempodiBasic - 12-10-2024

Hi friends
yesterday I was looking for a new washdishes machine in a store. The operator had used a modern PC on which it was running a database software managing the resource of the store. Well it was in SCREEN 0!
So  programs in text mode interface are still running in commercial software!
And this little demo/tutorial to build a text window is not so obsolete!

Code: (Select All)

' a little demonstration about making windows with text characters in Screen 0

' ---------------------  a bit of theory on windows in screen 0
'  ANATOMY of a Text Window
'
'  Upper Left corner      Title Bar      Title      Upper Right Corner
'    \                        |            |                  /
'    \                      |            |                  /
'      >ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ title on the bar ÍÍÍÍÍÍÍÍÍ»<
'        º                                                  º
'        º                                                  º
' lateralº              area of window                      º
'  bar ->º                                                  º
'        º                                                  º
'        º                                                  º
'      >ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ text on the status bar ÍÍÍÍÍÍÍÍͼ<
'      /                |              |                      \
'    /                |              |                      \
'Bottom Left corner  Status Bar      Status          Bottom Right corner

'the frame (cornice) of the window has its necessary elements: 4 corners (Upper Left, Upper Right, Bottom Left, Bottom Right)
' the title bar, the status bar and 2 lateral bars
'    the space within the frame is the area of the window: here text is scrolling by user input
'---------------

Screen 0
_FullScreen
_ControlChr Off

'global SHARED variables
Dim Shared As String UL, UR, BL, BR, HO, VE
Dim FC(1 To 3) As Integer, BC(1 To 3) As Integer ' it declares Foregroundcolor & Background color variables

' initialization
UL = "É": UR = "»": BL = "È": BR = "¼": HO = "Í": VE = "º"
FC(1) = 15: BC(1) = 1
FC(2) = 11: BC(2) = 2
FC(3) = 12: BC(3) = 3

'here it makes windows' frames
Color FC(1), BC(1)
makeWindow 1, 1, 80, 15, " Editor "
Color FC(2), BC(2)
makeWindow 15, 1, 80, 6, " Output "
Color FC(3), BC(3)
makeWindow 20, 1, 80, 7, " Help "
Color 15, 0
End



Sub makeWindow (row As Integer, col As Integer, widthW As Integer, heightW As Integer, TitleW As String)
    If Len(TitleW) > widthW Then TitleW = Left$(_Trim$(TitleW), 3)
    Locate row, col
    Print UL + String$(widthW - 2, HO) + UR;
    For a% = row + 1 To row + heightW - 2
        Locate a%, col
        Print VE + Space$(widthW - 2) + VE;
    Next a%
    Locate , col
    Print BL + String$(widthW - 2, HO) + BR;
    Locate row, col + Fix((widthW - Len(TitleW)) / 2)
    Print TitleW;
End Sub

Of course the setting of characters to use in the making of window frame can be different or moreover flexible.


[Image: Text-windows-in-SCREEN-0-Immagine-2024-12-10-015612.png]

Thanks for feedbacks