11-16-2025, 05:37 PM
Hi
here I post a snippet to test output of SCREEN keyword, used for setting video mode.
It gets keyboard/mouse input and let you test different SCREEN legacy mode and the others modes (by _NEWIMAGE).
it works in Lubuntu and within this last I recognize some issues about viewport of the window of the application... the more evident is when you create a 32bit window.
I let print for the first ten rows the cohordinates of MouseX , MouseY/_fontHeight, and number of row using PRINT keyword put in position by LOCATE.
Moreover I let draw the box of the edge of the window and the 2 major diagonales of the window that meet themselves in the centre of the viewport of the window.
Here 2 screenshot for who don't run Linux Lubuntu.
![[Image: image-2025-11-16-182516425.png]](https://i.ibb.co/4gK8Jrk3/image-2025-11-16-182516425.png)
![[Image: image-2025-11-16-182637626.png]](https://i.ibb.co/R4HvsZd4/image-2025-11-16-182637626.png)
Please make a try on other OSes so we can know if it is an isolated issue or it regards other Linux versions or/and MacOs.
I have never had a similar issue under Windows.
Here the code:
(be patient for mouse input... I am not able to slow the mouse input without affect the application working.)
here I post a snippet to test output of SCREEN keyword, used for setting video mode.
It gets keyboard/mouse input and let you test different SCREEN legacy mode and the others modes (by _NEWIMAGE).
it works in Lubuntu and within this last I recognize some issues about viewport of the window of the application... the more evident is when you create a 32bit window.
I let print for the first ten rows the cohordinates of MouseX , MouseY/_fontHeight, and number of row using PRINT keyword put in position by LOCATE.
Moreover I let draw the box of the edge of the window and the 2 major diagonales of the window that meet themselves in the centre of the viewport of the window.
Here 2 screenshot for who don't run Linux Lubuntu.
![[Image: image-2025-11-16-182516425.png]](https://i.ibb.co/4gK8Jrk3/image-2025-11-16-182516425.png)
![[Image: image-2025-11-16-182637626.png]](https://i.ibb.co/R4HvsZd4/image-2025-11-16-182637626.png)
Please make a try on other OSes so we can know if it is an isolated issue or it regards other Linux versions or/and MacOs.
I have never had a similar issue under Windows.
Here the code:
(be patient for mouse input... I am not able to slow the mouse input without affect the application working.)
Code: (Select All)
_Title "Lubuntu window's cohordinates bug"
''Screen Text Graphics Colors Video Text Default
'' Mode Rows Columns Width Height Attrib. BPP Pages Block QB64 Font
'' 0 25/43/50 80/40 No graphics 16/16 DAC 4 0-7 ----- _FONT 16
'' 1 25 40 320 200 16/4 BG 4 none 8 X 8 _FONT 8
'' 2 25 80 640 200 2/mono 1 none 8 X 8 _FONT 8
'' .................................................................................
'' 7 25 40 320 200 16/16 DAC 4 0-7 8 X 8 _FONT 8
'' 8 25 80 640 200 16/16 4 0-3 8 X 8 _FONT 8
'' 9 25 80 640 350 16/64 DAC 4 0-1 8 X 14 _FONT 14
'' 10 25 80 640 350 4/2 GScale 2 none 8 X 14 _FONT 14
'' 11 30/60 80 640 480 2/mono 1 none 8 X 16 _FONT 16
'' 12 30/60 80 640 480 16/262K 4 none 8 X 16 _FONT 16
'' 13 25 40 320 200 256/65K 8 none 8 X 8 _FONT 8
'' _NEWIMAGE width. height, 32
Randomize Timer
Dim ScrM As Integer, ScrMod As String, FeaT As String, Action As Integer
Dim Shared As Integer M1, M2, M3
ScrM = 0: ScrMod = "0": FeaT = "80/40 width * 25/43/50 height": Action = 0
M1 = 0: M2 = 0: M3 = 0
Do While Action <> 99
WaitStopMouseInput
Mainscreen
Mainloop ScrM, ScrMod, FeaT, Action
WaitStopMouseInput
If Action = 3 Then
If ScrM = 10 Then
Screen _NewImage(1000, 800, 32)
Else
Screen Val(ScrMod)
End If
test ScrMod, FeaT
End If
Loop
End
Sub test (Sm As String, F As String)
Cls
r = 1
Do
M1 = 0: M2 = 0: M3 = 0
WaitStopMouseInput
mx = _MouseX
my = _MouseY
For row = 1 To 10
Select Case Sm
Case "32bit"
Color _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
Case "2", "11"
Color 1
Case "10"
Color Int(Rnd * 3) + 1
Case Else
Color row
End Select
If Sm = "0" Then r = 1 Else r = _FontHeight
Locate row, 1
Print mx; " "; Int(my / r); " "; row
Next row
Locate 22
Print "Screen mode " + Sm + " " + F
Print "Press RIGHT mouse button or Escape key to exit";
Select Case Sm
Case "0"
' do not do graphic lines
Case Else
' it draws 2 lines to show vertexes and center of the screen, more a box on the edge of screen
Line (1, 1)-(_Width(0), _Height(0))
Line (_Width(0), 1)-(1, _Height(0))
Line (1, 1)-(_Width(0) - 1, _Height(0) - 1), , B
End Select
_Limit 20
Loop Until M2 = -1 Or InKey$ = Chr$(27)
WaitStopMouseInput
Screen 0
Cls
End Sub
Sub WaitStopMouseInput
Do While _MouseInput
M1 = _MouseButton(1): M2 = _MouseButton(2): M3 = _MouseButton(3)
Loop ' loop to clean mouse input buffer
End Sub
Sub Mainscreen
Screen 0
Print "Tool for testing the setting of screen viewport on the window application"
Locate 3
Color 5
Print "press U for Previous Screen Mode and D for Following Screen Mode"
Print " Enter for testing selected Screen mode"
Color 4
Print "press Left button of mouse for Previous Screen Mode and Right button of "
Print " mouse for following Screen Mode"
Print " Middle button of mouse for testing selected Screen Mode"
Color 14
Print " press Escape key or together Left and Right mouse buttons for quitting"
Color 1
Locate 13
Print "SCREEN " + Space$(15) + " Features"
End Sub
Sub Mainloop (S As Integer, Sm As String, F As String, A As Integer)
Do
Locate 14, 1
Print Space$(80);
Locate 14, 1
Print " " + Sm + Space$(15 - (Len(Sm))) + F
While TakeInput(A) = 0
_Limit 20
Wend
Select Case A
Case 1
'up action
S = S + 1
If S > 10 Then S = 0
Case 2
' down action
S = S - 1
If S < 0 Then S = 10
Case 3, 99
' execute action or exit
Exit Sub
End Select
A = 0 ' it restores neutral value of A
Select Case S
Case 0
Sm = "0"
F = "80/40 width * 25/43/50 height"
Case 1
Sm = "1"
F = " 320 200"
Case 2
Sm = "2"
F = "640 200"
Case 3
Sm = "7"
F = "320 200"
Case 4
Sm = "8"
F = "640 200"
Case 5
Sm = "9"
F = "640 200"
Case 6
Sm = "10"
F = "640 350"
Case 7
Sm = "11"
F = "640 480"
Case 8
Sm = "12"
F = "640 480"
Case 9
Sm = "13"
F = "320 200"
Case 10
Sm = "32bit"
F = "variable W & H "
End Select
Loop
End Sub
Function TakeInput (Action As Integer)
Action = 0
WaitStopMouseInput
C$ = InKey$
If (C$ = Chr$(27) Or (M1 = -1 And M2 = -1)) Then Action = 99
If (C$ = "U" Or M1 = -1) Then Action = 1
If (C$ = "D" Or M2 = -1) Then Action = 2
If (C$ = Chr$(13) Or M3 = -1) Then Action = 3
TakeInput = Action
End Function
PS It is fantastic the Export as... in the file meny of QB64pe IDE.



![[Image: image-2025-11-17-232114908.png]](https://i.ibb.co/9dXwQnt/image-2025-11-17-232114908.png)
![[Image: Kubuntu-running-Screenshot-20251129-182842.jpg]](https://i.ibb.co/pjy2rdmL/Kubuntu-running-Screenshot-20251129-182842.jpg)