Page 1 of 1
[OK] [5.50 to 5.61] WindowX
Posted: Wed Nov 29, 2017 1:55 pm
by ar-s
From topic :
http://www.purebasic.fr/french/viewtopi ... =1&t=17071
Yop,
It seems To be a bug with WindowX. WindowY seems good. (WINDOWS 10 x64 test)
It only move to the right and to 6px instead of 1px.
Code: Select all
#GOTOP = 1
#GODOWN = 2
#GOLEFT = 3
#GORIGHT = 4
OpenWindow(165,0,0,80,80,"",#PB_Window_BorderLess|#WS_SIZEBOX|#PB_Window_ScreenCentered)
StickyWindow(165,#True)
AddKeyboardShortcut(165,#PB_Shortcut_Up,1)
AddKeyboardShortcut(165,#PB_Shortcut_Down,2)
AddKeyboardShortcut(165,#PB_Shortcut_Left,3)
AddKeyboardShortcut(165,#PB_Shortcut_Right,4)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
; just a check
WX = WindowX(165) : WY = WindowY(165)
Select EventMenu()
Case #GOTOP
ResizeWindow(165,#PB_Ignore,WY-1,#PB_Ignore,#PB_Ignore)
Case #GODOWN
ResizeWindow(165,#PB_Ignore,WY+1,#PB_Ignore,#PB_Ignore)
Case #GOLEFT
ResizeWindow(165,WX-1,#PB_Ignore,#PB_Ignore,#PB_Ignore)
Case #GORIGHT
ResizeWindow(165,WX+1,#PB_Ignore,#PB_Ignore,#PB_Ignore)
EndSelect
;Problem here for left and right
Debug Str(wx) + " x " + Str(wy)
EndSelect
Until Event=#PB_Event_CloseWindow
End
Re: [5.50 to 5.61] WindowX
Posted: Wed Nov 29, 2017 4:26 pm
by falsam
This is a bug with #WS_SIZEBOX (#PB_Window_SizeGadget). By removing this constant, there is no such strange behavior.
Re: [5.50 to 5.61] WindowX
Posted: Wed Nov 29, 2017 4:42 pm
by nco2k
ResizeWindow() is calculating the wrong position, because it expects a borderless window to not have a border. if you remove #PB_Ignore from the y parameter, then it works as expected.
edit:
Code: Select all
#GOTOP = 1
#GODOWN = 2
#GOLEFT = 3
#GORIGHT = 4
OpenWindow(165,0,0,80,80,"",#PB_Window_BorderLess|#WS_SIZEBOX|#PB_Window_ScreenCentered)
StickyWindow(165,#True)
AddKeyboardShortcut(165,#PB_Shortcut_Up,1)
AddKeyboardShortcut(165,#PB_Shortcut_Down,2)
AddKeyboardShortcut(165,#PB_Shortcut_Left,3)
AddKeyboardShortcut(165,#PB_Shortcut_Right,4)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
; just a check
WX = WindowX(165) : WY = WindowY(165)
Select EventMenu()
Case #GOTOP
ResizeWindow(165,WX,WY-1,#PB_Ignore,#PB_Ignore)
Case #GODOWN
ResizeWindow(165,WX,WY+1,#PB_Ignore,#PB_Ignore)
Case #GOLEFT
ResizeWindow(165,WX-1,WY,#PB_Ignore,#PB_Ignore)
Case #GORIGHT
ResizeWindow(165,WX+1,WY,#PB_Ignore,#PB_Ignore)
EndSelect
;Problem here for left and right
Debug Str(wx) + " x " + Str(wy)
EndSelect
Until Event=#PB_Event_CloseWindow
End
c ya,
nco2k
Re: [5.50 to 5.61] WindowX
Posted: Wed Nov 29, 2017 5:04 pm
by falsam
Yes like this no problem
Code: Select all
OpenWindow(0, 0, 0, 100, 100,"",#PB_Window_BorderLess | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
AddKeyboardShortcut(0, #PB_Shortcut_Up, 1)
AddKeyboardShortcut(0, #PB_Shortcut_Down, 2)
AddKeyboardShortcut(0, #PB_Shortcut_Left, 3)
AddKeyboardShortcut(0, #PB_Shortcut_Right, 4)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
Select EventMenu()
Case 1
ResizeWindow(0, WindowX(0), WindowY(0)-1, #PB_Ignore, #PB_Ignore)
Case 2
ResizeWindow(0, WindowX(0), WindowY(0)+1, #PB_Ignore, #PB_Ignore)
Case 3
ResizeWindow(0, WindowX(0) - 1, WindowY(0), #PB_Ignore, #PB_Ignore)
Case 4
ResizeWindow(0, WindowX(0) + 1, WindowY(0), #PB_Ignore, #PB_Ignore)
EndSelect
EndSelect
Until EventID=#PB_Event_CloseWindow
Re: [5.50 to 5.61] WindowX
Posted: Wed Nov 29, 2017 5:21 pm
by ar-s
Thanks, the #WS_SIZEBOX was the problem.
Re: [OK] [5.50 to 5.61] WindowX
Posted: Wed Nov 29, 2017 8:39 pm
by nco2k
its still a bug though. purebasic should take this special case into account. if you are writing an app like steam for example, which is a sizeable, borderless window.
c ya,
nco2k
Re: [OK] [5.50 to 5.61] WindowX
Posted: Thu Nov 30, 2017 2:15 pm
by Fred
It's more a wish request because we don't officially support this flag.
Re: [OK] [5.50 to 5.61] WindowX
Posted: Thu Nov 30, 2017 2:29 pm
by nco2k
yes, but if you use #PB_Window_SizeGadget, the issue remains. no idea why he used #WS_SIZEBOX to demonstrate this problem.
Code: Select all
#GOTOP = 1
#GODOWN = 2
#GOLEFT = 3
#GORIGHT = 4
OpenWindow(165,0,0,80,80,"",#PB_Window_BorderLess|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
StickyWindow(165,#True)
AddKeyboardShortcut(165,#PB_Shortcut_Up,1)
AddKeyboardShortcut(165,#PB_Shortcut_Down,2)
AddKeyboardShortcut(165,#PB_Shortcut_Left,3)
AddKeyboardShortcut(165,#PB_Shortcut_Right,4)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
; just a check
WX = WindowX(165) : WY = WindowY(165)
Select EventMenu()
Case #GOTOP
ResizeWindow(165,#PB_Ignore,WY-1,#PB_Ignore,#PB_Ignore)
Case #GODOWN
ResizeWindow(165,#PB_Ignore,WY+1,#PB_Ignore,#PB_Ignore)
Case #GOLEFT
ResizeWindow(165,WX-1,#PB_Ignore,#PB_Ignore,#PB_Ignore)
Case #GORIGHT
ResizeWindow(165,WX+1,#PB_Ignore,#PB_Ignore,#PB_Ignore)
EndSelect
;Problem here for left and right
Debug Str(wx) + " x " + Str(wy)
EndSelect
Until Event=#PB_Event_CloseWindow
End
c ya,
nco2k
Re: [OK] [5.50 to 5.61] WindowX
Posted: Thu Nov 30, 2017 4:29 pm
by ar-s
no idea why he used #WS_SIZEBOX to demonstrate this problem.
Because he want to make a kind og GUI like steam, without the top toolbar.
I don't know if the team could add a flag to the openwindows() command to make this possible.
Re: [OK] [5.50 to 5.61] WindowX
Posted: Thu Nov 30, 2017 4:39 pm
by nco2k
>> Because he want to make a kind og GUI like steam, without the top toolbar.
yes, but you could have simply used #PB_Window_SizeGadget.
>> I don't know if the team could add a flag to the openwindows() command to make this possible.
ofc it would be possible, but i doubt it will ever happen, because its a windows thing.
c ya,
nco2k
Re: [OK] [5.50 to 5.61] WindowX
Posted: Thu Nov 30, 2017 5:36 pm
by ar-s
#PB_Window_SizeGadget let a normal titlebar. #WS_SIZEBOX let a small one, even smaller than with #PB_Window_Tool
Re: [OK] [5.50 to 5.61] WindowX
Posted: Thu Nov 30, 2017 6:18 pm
by nco2k
thats not how steam does it. here is your steam:
http://www.purebasic.fr/english/viewtop ... 12&t=69716
c ya,
nco2k
Re: [OK] [5.50 to 5.61] WindowX
Posted: Sat Dec 02, 2017 6:32 am
by ar-s
thanks you