Page 1 of 1

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

Posted: Tue Mar 25, 2025 10:06 pm
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!

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

Posted: Wed Mar 26, 2025 7:45 am
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.

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

Posted: Wed Mar 26, 2025 12:24 pm
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


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

Posted: Wed Mar 26, 2025 5:44 pm
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!