Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ilyas Ansar
  Where is Ilyas Ansar?
 Vansda
 India
 Ilyas Ansar
 To: Bob Brook
  Where is Bob Brook?
 Surrey
 United Kingdom
 Bob Brook
 Tags
Subject: RE: Totals at bottom of Grids
Thread ID: 396043 Message ID: 396250 # Views: 47 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Friday, January 24, 2014 2:36:16 AM         
   


> I have recently added Peter Sass's grid totals grid to forms in my applications.
> They work(ed) fine and I set the default height of the totgrid to 20px and would increase it to the height of the rows in the main grid plus twice the line height.
>
> On XP and some Windows 7 OS PC's this works without problem.
>
> Yesterday, received error messages numbered 2005 from a client using Windows 7.
>
> On investigation it turns out that the minimum height I was using of 20 was causing the error. If I set the totgrid classes height to 40 and in the SetPosition method use a Do Loop and a Try Catch EndTry structure on setting the totgrid height for an actual form with an incrementing variable to slowly increase the grids height. It overcomes the problem.
>
> On my XP system if I try to set a grid height of less than 20 under VFP - it gives an error.
> This is the 2005 error that the end user gets when running the program.
>
> I suppose my question is: why for some operating systems, what is in their environment that could cause a 2005 error on some PC's but not on others. It may also be a problem for some Windows 8 PC's but as yet none have reported an error.
>
> I suspected the style/type of Window display being used, but on changing to Windows Classic or Windows XP under the Control Panel, has no effect on the error.
>
>
> Regards
>
> Bob of Surrey, England

problem not in grid total control but windows os screen resolution, may be following code work for you.



** grid init 
DODEFAULT()
*!* Ilyas Ansari, 04/01/2011 12:49:25 PM 
*!* 
DECLARE INTEGER GetDC IN user32 INTEGER hwnd
DECLARE INTEGER ReleaseDC IN user32 INTEGER hwnd, INTEGER hdc
DECLARE INTEGER GetDeviceCaps IN gdi32 INTEGER hdc, INTEGER nIndex

#DEFINE LOGPIXELSX        88
#DEFINE LOGPIXELSY        90 
LOCAL hdc
hdc = GetDC(0)  && entire screen    
nX = GetDeviceCaps(hdc, LOGPIXELSX)
nY = GetDeviceCaps(hdc, LOGPIXELSY)
do case
	case nX =96 or nY = 96
		this.Height = 20
	case nX =120 or nY =120
		this.Height = 24
otherwise
		this.Height = 20
endcase 

**** rest of the code 
*** 
if not Empty(this.cSourceGrid)
	local oSrcGrid
	oSrcGrid = .null.
...
.....



ilyas ansari ,

ENTIRE THREAD

Totals at bottom of Grids Posted by Bob Brook @ 1/22/2014 2:14:53 PM
RE: Totals at bottom of Grids Posted by Stefan Wuebbe @ 1/22/2014 3:00:58 PM
RE: Totals at bottom of Grids Posted by Bob Brook @ 1/22/2014 4:34:42 PM
RE: Totals at bottom of Grids Posted by Pete Sass @ 1/22/2014 7:21:34 PM
RE: Totals at bottom of Grids Posted by Bob Brook @ 1/22/2014 8:41:16 PM
RE: Totals at bottom of Grids Posted by Pete Sass @ 1/22/2014 9:37:49 PM
RE: Totals at bottom of Grids Posted by Bob Brook @ 1/23/2014 11:22:21 AM
RE: Totals at bottom of Grids Posted by Vicos Vicos @ 1/24/2014 10:59:09 PM
RE: Totals at bottom of Grids Posted by Ilyas Ansar @ 1/24/2014 2:36:16 AM
RE: Totals at bottom of Grids Posted by Bob Brook @ 1/24/2014 11:24:20 AM
RE: Totals at bottom of Grids Posted by Bob Brook @ 1/24/2014 1:10:24 PM