[OK] [5.50 to 5.61] WindowX

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 340
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

[OK] [5.50 to 5.61] WindowX

Post 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
Last edited by ar-s on Wed Nov 29, 2017 5:22 pm, edited 1 time in total.
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: [5.50 to 5.61] WindowX

Post by falsam »

This is a bug with #WS_SIZEBOX (#PB_Window_SizeGadget). By removing this constant, there is no such strange behavior.

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: [5.50 to 5.61] WindowX

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: [5.50 to 5.61] WindowX

Post 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

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 340
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

Re: [5.50 to 5.61] WindowX

Post by ar-s »

Thanks, the #WS_SIZEBOX was the problem.
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: [OK] [5.50 to 5.61] WindowX

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Fred
Administrator
Administrator
Posts: 16687
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [OK] [5.50 to 5.61] WindowX

Post by Fred »

It's more a wish request because we don't officially support this flag.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: [OK] [5.50 to 5.61] WindowX

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 340
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

Re: [OK] [5.50 to 5.61] WindowX

Post 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.
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: [OK] [5.50 to 5.61] WindowX

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 340
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

Re: [OK] [5.50 to 5.61] WindowX

Post by ar-s »

#PB_Window_SizeGadget let a normal titlebar. #WS_SIZEBOX let a small one, even smaller than with #PB_Window_Tool
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: [OK] [5.50 to 5.61] WindowX

Post by nco2k »

thats not how steam does it. here is your steam: http://www.purebasic.fr/english/viewtop ... 12&t=69716

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 340
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

Re: [OK] [5.50 to 5.61] WindowX

Post by ar-s »

thanks you
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
Post Reply