It is currently Thu Oct 24, 2019 6:04 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: PB5.30 Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Fri Sep 26, 2014 7:23 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 650
Location: Portugal
Hello!

I tried to run the tool I am coding in an laptop with Windows 8.1 and Iris resolution (above Full-HD) and my little sticky window doesn't appear on the screen.

Since the computer is my Professor's I didn't have the chance of making PB tests in it, but here is the code I use for the pop-up window:

Code:
    ; Open the properties window
    If IsWindow(#PROPERTIES)=#False
      w=200-30-30+4
      h=200-30-30+5+25-10-3
      OpenWindow(#PROPERTIES,DesktopWidth(0)-w-5-5-5-4,100-16-4,w,h,"Properties",#PB_Window_Tool)
      StickyWindow(#PROPERTIES,#True)
     
      ; set the window active
      SetActiveWindow(#PROPERTIES)
     
      ; Place the gadgets
      ImageGadget(#IMAGE_WINDOW_PROPERTIES,0+20+10+2,0,68,86,0)
      TextGadget(#TEXT_WINDOW_PROPERTIES_1,5+10,100-2-3-3,140+15+100,20,"")
      TextGadget(#TEXT_WINDOW_PROPERTIES_2,5+10,100+20+2-2-3-3-2,140+15+100,20,"")
      TextGadget(#TEXT_WINDOW_PROPERTIES_3,5+10,100+20+2+20+2-2-3-3-2-2,140+15+100,20,"")
     
      ; Set the active window back to the main
      SetActiveWindow(#WINDOW_MAIN)
     
    EndIf



Maybe there is some issue with DesktopWidth(0)?

Could someone test it?

Thanks!

Kind regards,
>Marco A.G.Pinto
---------------


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Fri Sep 26, 2014 8:48 am 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4368
Location: Germany
Hi,

I miss your ExamineDesktops().
In 5.31 this results in an error.
Does your code work in your PB edition?

Bernd


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Fri Sep 26, 2014 10:13 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13622
Location: France
You will need to post full working snippet if you want us to look at a bug, because toying with an incomplete code is just waste of time as we don't even know if we meet the same conditions.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Fri Sep 26, 2014 1:19 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5781
Location: Germany
You also need to use DesktopX()/DesktopY() because you cannot assume that the monitor has the origin at the (0, 0) coordinate. My guess is that is your problem.

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Fri Sep 26, 2014 3:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 650
Location: Portugal
Fred wrote:
You will need to post full working snippet if you want us to look at a bug, because toying with an incomplete code is just waste of time as we don't even know if we meet the same conditions.


My dear Fred and friends,

Here is a snippet.

Please notice that this is very strange because the full tool I am developing for my PhD works fine on my both laptops, but it only has this issue with my Professor's Iris laptop.

1) My notebook: 1366x768
2) My netbook: 1024x600

Code:
  Enumeration
    #WINDOW_MAIN
    #PROPERTIES
    #IMAGE_WINDOW_PROPERTIES
    #TEXT_WINDOW_PROPERTIES_1
    #TEXT_WINDOW_PROPERTIES_2
    #TEXT_WINDOW_PROPERTIES_3
  EndEnumeration
 
 
 
  Declare properties(t) 
 
 

  ; INIT STUFF
 
  ; Get the PC core - x64 or x86 only
  t$=""
  CompilerIf #PB_Compiler_Processor = #PB_Processor_x86 : t$="x86" : CompilerEndIf
  CompilerIf #PB_Compiler_Processor = #PB_Processor_x64 : t$="x64" : CompilerEndIf

  ; Open the main window 
  ExamineDesktops()
  If OpenWindow(#WINDOW_MAIN,0,0,1024,768,"Testing Tool ("+t$+")",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_Maximize)=#False : MessageRequester("Error", "Can't open a window.") : EndIf
 
 
  ; Open sticky window
  properties(1)
 
 
  quit=#False
  Repeat
   
    event=WaitWindowEvent()
   
    Select event

      Case #PB_Event_CloseWindow
         Select EventWindow()
             
           ; User has pressed the close window gadget 
           Case #WINDOW_MAIN
             quit=#True
             
         EndSelect
       
    EndSelect         
   
   
  Until quit=#True
 
 
 
  Procedure properties(t)
   
    ; Open the properties window
    If IsWindow(#PROPERTIES)=#False
      w=200-30-30+4
      h=200-30-30+5+25-10-3
      OpenWindow(#PROPERTIES,DesktopWidth(0)-w-5-5-5-4,100-16-4,w,h,"Properties",#PB_Window_Tool)
      StickyWindow(#PROPERTIES,#True)
     
      ; set the window active
      SetActiveWindow(#PROPERTIES)
     
      ; Place the gadgets
      ImageGadget(#IMAGE_WINDOW_PROPERTIES,0+20+10+2,0,68,86,0)
      TextGadget(#TEXT_WINDOW_PROPERTIES_1,5+10,100-2-3-3,140+15+100,20,"")
      TextGadget(#TEXT_WINDOW_PROPERTIES_2,5+10,100+20+2-2-3-3-2,140+15+100,20,"")
      TextGadget(#TEXT_WINDOW_PROPERTIES_3,5+10,100+20+2+20+2-2-3-3-2-2,140+15+100,20,"")
     
      ; Set the active window back to the main
      SetActiveWindow(#WINDOW_MAIN)
     
    EndIf   
   
   
  EndProcedure
 



Is this helpful?

Thanks!

Kind regards,
>Marco A.G.Pinto
---------------


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Sat Jun 27, 2015 7:21 pm 
Offline
User
User

Joined: Sun Jun 14, 2015 8:25 pm
Posts: 11
i´m have the same problem with my windows tab under win8.1 DesktopX has a mal function

by Debug DesktopX(0) is the output 0
by Debug DesktopX(1) is the output 1440 thats the result from main desktop not from second desktop

by Debug DesktopY(0) is the output 0
by Debug DesktopY(1) is the output -53

by using windows 7 or OS X Yosemite i´m have not this problems


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Sun Jun 28, 2015 3:21 am 
Offline
Enthusiast
Enthusiast

Joined: Tue May 24, 2011 1:36 pm
Posts: 276
Well this took me all of 10 seconds to diagnose...

It's to do with high DPI and scaling.

I have a 4k monitor next to a 2k monitor which I normally run in 100% mode, but for this test I have altered the window scaling to 150%.

If I run the Desktop.pb from the examples folder I get the following details:

Image

Image

Image

You will notice the bluryness, this is because I have set my desktop into 150% screen scaling (under control panel> display > adjust resolution > make text and other items larger or smaller)

This means the dimensions of my 4k monitor are now:

(3840 / 150) *100 = 2560 wide
(2160 / 150) * 100 = 1440 high

However this is being reported incorrectly via the Desktop library as is evident in the screenshots of if I open a window using PB and move it to around 2550,0 it opens almost in the top right corner.

DesktopMouseX() and DesktopMouseY() report the correct value when I move the mouse to the lower right corner of the screen the mouse position reads 2559,1439 (0 based).

If you need any more info, let me know.

I think this ideally needs to be looked at as a core library correction / addition, maybe another function DesktopScaling(#Desktop) to return the scaling factor and for the Desktop function to take this into account in their calculations and act accordingly?


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.30] Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Fri Jul 31, 2015 8:25 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13622
Location: France
Fixed.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] PB5.30 Bug in DesktopWidth(0) - Iris resolution?
PostPosted: Tue Oct 06, 2015 10:07 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13622
Location: France
To be reworked with DPI aware changes.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye