Screen display specification

New to FreeBASIC? Post your questions here.
rogerbohl
Posts: 86
Joined: Jan 29, 2012 22:22

Screen display specification

Postby rogerbohl » Dec 25, 2017 0:52

I have been using a 5000-line FreeBasic program I wrote a few years ago, quite happily. At that time, I had challenges specifying the screen parameters, but managed to establish suitable commands to just display text on the screen.

I've now started using a new Windows 10 computer, with a monitor having a different aspect ratio; while the program runs happily, the image runs off the screen at the bottom. Despite what I thought were useful comments when I wrote the program, I cannot find the command in my code that establishes the screen image parameters, so that I can adjust them for the new screen aspect ratio. The former screen was 14" wide by 8.5" high; the new one is 15.5" wide by 9" high. Can someone please point me in the right direction?

Thanks!

Roger Bohl
bcohio2001
Posts: 483
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Screen display specification

Postby bcohio2001 » Dec 25, 2017 2:45

Search for the command "ScreenRes" in your code.
paul doe
Posts: 701
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Screen display specification

Postby paul doe » Dec 25, 2017 11:13

Here's the complete list of FB graphic commands: https://www.freebasic.net/wiki/wikka.php?wakka=CatPgGfx.
rogerbohl
Posts: 86
Joined: Jan 29, 2012 22:22

Re: Screen display specification

Postby rogerbohl » Dec 25, 2017 22:11

bcohio2001 wrote:Search for the command "ScreenRes" in your code.


At the beginning of the main program, there is no "ScreenRes" command. There is a "Screen 20" followed by "Width 150,80" command. 0

For "20", in the documentation I see....
"20 1024x768 128x48 or 128x96 8x16 or 8x8 256K colors to 256 attributes or direct color"

The computer's display is set at "recommended" settings of 1368 x 768. Other options are available in Settings. I presume the big numbers are pixels, the "width" numbers are characters.

Perhaps I need a primer on how FreeBasic expresses and utilizes size information for different size (inches) screens with different resolutions.
jj2007
Posts: 749
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Screen display specification

Postby jj2007 » Dec 25, 2017 23:49

rogerbohl wrote:The computer's display is set at "recommended" settings of 1368 x 768
...
Perhaps I need a primer on how FreeBasic expresses and utilizes size information for different size (inches) screens with different resolutions.

Your screen is probably 1366 x 768 (see here for an explanation). Most notebooks have the same. I echo the need for a primer - any expert around? My Win7 notebook has the same 1366x768 resolution, probably 32 bits colour depth. Windows won't even tell me that detail, and it won't allow me to change anything, so I really wonder why FB has these commands. Is that QB legacy, or does it make any sense in a recent Windows environment?
MrSwiss
Posts: 2728
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Screen display specification

Postby MrSwiss » Dec 26, 2017 10:48

rogerbohl wrote: There is a "Screen 20" followed by "Width 150,80" command.
Yes and no, because:
Screen 20 = ScreenRes 1024, 768 but, the specified Width ... doesn't seem to match?
You'd usually would want to use a 16x8 Font size on such 'large' resolution (not the 8x8).

Therefore, the Width would have to be: 1024\8, 768\16 ... (int. div., not float div.!)
aka: 128 x 48 (the Char's per Line (width), the Line amount (height))

You'll have to keep in mind, that Screen/ScreenRes refers to the size of the *User-Window*
and not to the really used size *on Screen*, which is larger (add borders sizes and Title-Bar
height). Exception: if you are using *no Frames* setting, with ScreenRes() only.

jj2007 wrote:Windows won't even tell me that detail, and it won't allow me to change anything ...
Use ScreenInfo() but, before entering graphic's mode (set with: ScreenRes() ).
You can change, whatever you want, but this applies to your program only ...
rogerbohl
Posts: 86
Joined: Jan 29, 2012 22:22

Re: Screen display specification

Postby rogerbohl » Dec 28, 2017 22:48

I'm still at a loss as to how to stop the FreeBasic Window from overrunning the bottom of the screen. (There is content at the bottom that is not visible.)

Should I adjust my computer screen setting (for this application, only -- Ugh!) to other than the "Recommended" setting?

How do the numbers in the Width command (Width 120,80) affect the window displayed?

Is there another command (of which I am not aware) that would make the FreeBasic window less "tall"?

Thanks for all the help offered!

Roger
MrSwiss
Posts: 2728
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Screen display specification

Postby MrSwiss » Dec 28, 2017 23:18

rogerbohl wrote:... as to how to stop the FreeBasic Window from overrunning the bottom of the screen.
You'll just have to try it out, with some empirical tests, such as:

Code: Select all

' try out the max. size of "user window"
Const As ULong  sw = 1024, sh = 736, cd = 32    ' 32 bits less than physical height 768

ScreenRes(sw, sh, cd)
Width sw\8, sh\16       ' 128 X 46 -- Char's x Lines
Color(&hFF000000, &hFFFFFFFF) : Cls ' black chars on white

Locate  2, 2 : Print "just a test"
Locate 45, 2 : Print "press a key to QUIT !"

Sleep
rogerbohl wrote:Should I adjust my computer screen setting (for this ...
No, don't touch ...
rogerbohl wrote:How do the numbers in the Width command (Width 120,80) affect the window displayed?
As explained in previous post ...
dodicat
Posts: 5086
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Screen display specification

Postby dodicat » Dec 29, 2017 0:46

I made the old style frame (I think it should be the same for all win 10)
I made a maximum screenres to fill the desktop.
I can catch the frame top with the mouse to move it, but I make it spring back on release.
I can read the bottom line of the screen.

Code: Select all

#include "fbgfx.bi"
Declare Function SetWindowTheme Lib "UxTheme.dll" Alias "SetWindowTheme"(As Any Ptr,As zstring Ptr,As zstring Ptr) As Long

dim as integer dw,dh
screencontrol fb.GET_DESKTOP_SIZE,dw,dh

screenres dw,dh,32,,fb.GFX_ALWAYS_ON_TOP or fb.GFX_HIGH_PRIORITY

dim as any ptr win
Screencontrol(fb.GET_WINDOW_HANDLE ,Cast(Integer,win))
SetWindowTheme(win," "," ") 'old style frame

windowtitle "Old style frame"
width dw\8,dh\16  'max fontsize
do

screencontrol fb.SET_WINDOW_POS   ,0,-24
draw string(50,0),"Top"
draw string(50,dh-16), "HELLO from the bottom line"
sleep 10,1
loop until len(inkey)
sleep
sancho3
Posts: 269
Joined: Sep 30, 2017 3:22

Re: Screen display specification

Postby sancho3 » Dec 29, 2017 20:05

The width command will try to set the size of the text in graphics mode (screen 20).
Since the values used are invalid, it will not have any effect on the screen/text.
If rows / cols is an invalid combination, no changes are made to the screen display.

Screen 20 on my win xp machine gives a tall window with the bottom cut off (like yours). Some acceptable resolutions (see screenlist) also do the same. Some cut off the top when maximized.
I have tried many times to fix this by adjusting monitor settings and centering and "nudging" the via the monitors built in menu. It has never worked.
My xp monitor settings are 1280 x 720
You can try setting a higher monitor resolution via windows and it might work.
On my linux machine and a much higher monitor resolution screen 20 fits.
My linux monitor is 1440 x 900
Otherwise use the screenlist command to come up with a list of screen/window sizes and pick one that doesn't run off the bottom.

@Dodicat: Your window also hides half of the last line off the bottom on my xp machine.
paul doe
Posts: 701
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Screen display specification

Postby paul doe » Dec 29, 2017 23:23

How about this?

Code: Select all

#include once "fbgfx.bi"
#include once "windows.bi"

dim as integer desktopWidth, desktopHeight

desktopWidth = getSystemMetrics( SM_CXFULLSCREEN )
desktopHeight = getSystemMetrics( SM_CYFULLSCREEN ) + getSystemMetrics( SM_CYCAPTION )
               
screenRes( desktopWidth, desktopHeight, 32, , fb.gfx_alpha_primitives or fb.gfx_no_frame )
screenControl( fb.set_window_pos, 0, 0 )

width desktopWidth \ 8, desktopHeight \ 16
locate 45, 10

? "Desktop test";

line( 0, 0 ) - ( desktopWidth - 1, desktopHeight - 1 ), rgba( 255, 255, 0, 255 ), b

sleep()

Windows only, unfortunately...
sancho3
Posts: 269
Joined: Sep 30, 2017 3:22

Re: Screen display specification

Postby sancho3 » Dec 30, 2017 2:59

@Paul
I can not see the line at the top until top = 2 and cannot see the line at the bottom until -1 as well:

Code: Select all

line( 2, 2 ) - ( desktopWidth - 2, desktopHeight - 2 ), rgba( 255, 255, 0, 255 ), b
paul doe
Posts: 701
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Screen display specification

Postby paul doe » Dec 30, 2017 3:31

@sancho3: Mmm, that's pretty weird. Works fine here (Win10). And the lines at the sides?
Image
As you can see, the size of the taskbar is taken into account, so that shouldn't happen. Perhaps some other system metric has to be added/substracted (like the window borders).
sancho3
Posts: 269
Joined: Sep 30, 2017 3:22

Re: Screen display specification

Postby sancho3 » Dec 30, 2017 4:17

The lines on the sides are visible.
With the taskbar hidden the bottom line is visible. The top still missing.
With Dodicats code the bottom line is still cut in half even with the taskbar hidden.
On some screenres settings I lose top/left. I can use the monitors adjustments to get them visible, but that moves the bottom/right out of visibility.
I wrote this off as a older graphics card/monitor/xp issue. I just work around it by using different screenres settings.
rogerbohl
Posts: 86
Joined: Jan 29, 2012 22:22

Re: Screen display specification

Postby rogerbohl » Sep 04, 2018 19:17

Found the cause of the problem and the solution:

Problem:
Evidently, Windows uses Notepad to generate the screen display and print output. It is this program that generates the margins, including one at the top that pushes the content off the bottom of screen.

Solution:
It is possible to set the margins within Notepad++, but it takes some extra work with Windows registry to retain them for the next call.

I found the answer on line. It may have been the following, and did the job for me, but you should do your own research.


https://www.itprotoday.com/management-m ... p-settings

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 1 guest