[PB 6.21 beta 2] Window doesn't appear at (x,y)=(0,0)

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

[PB 6.21 beta 2] Window doesn't appear at (x,y)=(0,0)

Post by marcoagpinto »

Heya,

Months ago I was complaining that the window appeared partly hidden (negative coordinates).

With the latest beta, it now appears more to the right (not (0,0)).

Here is a code reproducing it on the latest Windows 11:

Code: Select all

    ; Open a Window
    ; 2/MAR/2024: Added #PB_Window_SizeGadget to main open window to fix Windows 11 issue of them appearing not at (0,0): https://www.purebasic.fr/english/viewtopic.php?t=83461
    w=1024 ;+get_extra_width(100)
    h=600  ;+get_extra_height(100)
    #WINDOW_MAIN=1
    If OpenWindow(#WINDOW_MAIN,0,0,w,h,"Proofing Tool GUI V"+current_version$+" build "+current_build$,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)=#False : MessageRequester("Error", "Can't open a window.", #PB_MessageRequester_Error) : EndIf
    Repeat
    Until WaitWindowEvent()=#PB_Event_CloseWindow
    

Thanks!
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PB 6.21 beta 2] Window doesn't appear at (x,y)=(0,0)

Post by Fred »

Ask Microsoft why it's like that :D . A 0,0 window coordinate includes the shadow border that's why it looks like that. We removed the 'fix' which was actually introducing more issues that it was solving.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: [PB 6.21 beta 2] Window doesn't appear at (x,y)=(0,0)

Post by RASHAD »

For Windows
Drag : To move Window
Esc : To end

Code: Select all

OpenWindow(0,0,0,400,300,"Test",#PB_Window_SystemMenu|  #PB_Window_MaximizeGadget)
SetWindowLongPtr_(WindowID(0), #GWL_STYLE,GetWindowLongPtr_(WindowID(0), #GWL_STYLE) &~ #WS_DLGFRAME)
;SetWindowColor(0,#Gray)

Repeat
  Select WaitWindowEvent()
      
    Case #WM_CHAR
      If GetAsyncKeyState_(#VK_ESCAPE) & $8000 = 32768
        Quit = 1
      EndIf 
      
    Case #WM_LBUTTONDOWN
      If Run = 0
        SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
      EndIf
      
  EndSelect 
  
Until Quit = 1
End

Egypt my love
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB 6.21 beta 2] Window doesn't appear at (x,y)=(0,0)

Post by marcoagpinto »

What about this approach?:

Code: Select all

    x=0
    If OSVersion()=#PB_OS_Windows_11 : x-7 : EndIf ; Now the GUI window appears at (0,0) in Windows 11 desktop - 26/MAR/2025
    If OpenWindow(#WINDOW_MAIN,x,0,w,h,"Proofing Tool GUI V"+current_version$+" build "+current_build$,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)=#False : MessageRequester("Error", "Can't open a window.", #PB_MessageRequester_Error) : EndIf
Could you tell me if the issue only happens with Windows 11 and not with 10?

My two laptops have Windows 11.

Thanks!
Post Reply