Window width is wrong (bug or no bug?)

Windows specific forum
infratec
Always Here
Always Here
Posts: 6873
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Window width is wrong (bug or no bug?)

Post by infratec »

Hi,

Code: Select all

OpenWindow(0, 0, 0, 120, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    
Debug Str(WindowWidth(0)) + "x" + Str(WindowHeight(0))

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
My debug output (and the real size): 130x120

Win10 x64 and PB 5.61 x86

Bernd
Last edited by infratec on Thu Oct 05, 2017 12:41 pm, edited 3 times in total.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: Window width is wrong

Post by kenmo »

It's an OS limitation, you have to specify the BorderLess flag or else the OS puts a minimum size on your window (seems to be 126x10 for me).

Code: Select all

OpenWindow(0, 0, 0, 120, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_BorderLess)
   
Debug Str(WindowWidth(0)) + "x" + Str(WindowHeight(0))

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
infratec
Always Here
Always Here
Posts: 6873
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Window width is wrong

Post by infratec »

Ups... never recognized such a behaviour.
Normally my windows are larger :wink:
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: [Done]Window width is wrong

Post by nco2k »

you can use WindowBounds(#Window, MinWidth, MinHeight, MaxWidth, MaxHeight) to change the default size limits.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
infratec
Always Here
Always Here
Posts: 6873
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [Done]Window width is wrong

Post by infratec »

An additional ResizeWindow() is needed too:

Code: Select all

OpenWindow(0, 0, 0, 100, 100, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

Debug Str(WindowWidth(0)) + "x" + Str(WindowHeight(0))

WindowBounds(0, 1, 1, #PB_Ignore, #PB_Ignore)

ResizeWindow(0, #PB_Ignore, #PB_Ignore, 100, 100)

Debug Str(WindowWidth(0)) + "x" + Str(WindowHeight(0))

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
But then I think it is a bug.
This should be the default, or it should be mentioned in the help.

I checked 15 minutes why my image was not centered correctly :wink:
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: [Done]Window width is wrong

Post by Bisonte »

infratec wrote:...or it should be mentioned in the help....
It is there in "OpenWindow" ...:
German Help wrote:Auf Windows kann die Breite und Höhe eines Fensters mit Titelzeile nicht kleiner als etwa 100 Pixel sein. Zum Öffnen eines kleineren Fensters verwenden Sie das #PB_Window_BorderLess Flag (rahmenloses Fenster).
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
infratec
Always Here
Always Here
Posts: 6873
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Window width is wrong (bug or no bug?)

Post by infratec »

Hi, hi,

but I don't want a borderless window.
And it is not the truth as you can see at my example. :mrgreen:

Tested with 60 pixels and it works.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Window width is wrong (bug or no bug?)

Post by RASHAD »

No bug
This is a Windows limitation with #PB_Window_SystemMenu(icon+title+Control buttons[at least close button])
Try #PB_Window_Tool instead to see the difference
Egypt my love
Post Reply