forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

negative values for GET_WINDOW_LOCATION@ ?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Ralf



Joined: 30 Aug 2007
Posts: 50
Location: munich

PostPosted: Tue Nov 12, 2013 10:08 am    Post subject: negative values for GET_WINDOW_LOCATION@ ? Reply with quote

I have some problems with the positioning of windows using the %sp command with multiple screens, when the left screen is not the primary screen.
In this case the command GET_WINDOW_LOCATION@ returns positive x-values for windows on the primary screen, starting with "0" on the left border on the primary screen, but for windows on the secondary screen it returns always "0" instead of negative values.
Is there a way to get the correct (i.e. negative) postion of those windows?

Regards

Ralf
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sat Dec 20, 2014 11:12 pm    Post subject: Reply with quote

As of this writing, that is not the case, and negative values are returned for a screen that is secondary and logically on the right side of the main screen.
Back to top
View user's profile Send private message Visit poster's website
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Sun Dec 21, 2014 3:59 pm    Post subject: Reply with quote

Ralf,
A couple of programs which may help:
Code:
      winapp
      STDCALL GETSYSTEMMETRICS 'GetSystemMetrics' (VAL):INTEGER*4

      integer*4 SM_CXSCREEN , SM_CYSCREEN, SM_XVIRTUALSCREEN,              &
                SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN,                     &
                SM_CYVIRTUALSCREEN, SM_CMONITORS, SM_SAMEDISPLAYFORMAT


      SM_CXSCREEN          =  0
      SM_CYSCREEN          =  1
      SM_XVIRTUALSCREEN    = 76
      SM_YVIRTUALSCREEN    = 77
      SM_CXVIRTUALSCREEN   = 78
      SM_CYVIRTUALSCREEN   = 79
      SM_CMONITORS         = 80
      SM_SAMEDISPLAYFORMAT = 81

      Print*,'Number of monitors'
      print *,GetSystemMetrics(SM_CMONITORS)
      print *,'Same display format'
      print *,GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
      print *,'Coordinates of left and top of virtual screen'
      print *,GetSystemMetrics(SM_XVIRTUALSCREEN)
      print *,GetSystemMetrics(SM_YVIRTUALSCREEN)
      print *,'Width and height of virtual screen'
      print *,GetSystemMetrics(SM_CXVIRTUALSCREEN)
      print *,GetSystemMetrics(SM_CYVIRTUALSCREEN)
      print *,'Width and height of primary monitor'
      print *,GetSystemMetrics(SM_CXSCREEN)
      print *,GetSystemMetrics(SM_CYSCREEN)

      end

For my computer with twin screens (Primary = 1920 x 1080 and secondary 1280 x 1024), this returns:
Number of monitors
2
Same display format
1
Coordinates of left and top of virtual screen
0
0
Width and height of virtual screen
3200
1080
Width and height of primary monitor
1920
1080

Second program places two windows, one on each screen and determines their size and position. Which matches the requested information. The second screen is derived from the above program.
Code:
      winapp
      include <windows.ins>
      ix1 = 200
      iy1 = 100
      icontrol1 = 1
      i=winio@('%ww%ca[Window1]%sz&',ix1,iy1)
      i=winio@('%sp%hw%lw',0,0,ihandle1,icontrol1)
      ix2 = 400
      iy2 = 100
      icontrol2 = 1
      i=winio@('%ww%ca[Window2]%sz&',ix2,iy2)
      i=winio@('%sp%hw%lw',1921,10,ihandle2,icontrol2)
      call get_window_location@(ihandle1,iposx1,iposy1,iwidth1,iheight1)
      call get_window_location@(ihandle2,iposx2,iposy2,iwidth2,iheight2)
      print *,'Position and size of window 1'
      print *,iposx1,iposy1,iwidth1,iheight1
      print *,'Position and size of window 2'
      print *,iposx2,iposy2,iwidth2,iheight2

      end

Hope this helps. Note when get_window_location@ and move_window@ are used on individual controls, the positions are within the window, not screen position, but one refers to the top corner of the outer edge of the window and the other to the top corner of the available window space underneath any menu which may be used and some trickery is required to harmonise the two. See this post http://forums.silverfrost.com/viewtopic.php?t=2619&highlight=movewindow

See this link for the explanation of the GetSystemMetrics function
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385
Ian
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group