Welcome to MSDN Blogs Sign in | Join | Help

Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

If you’re running a Foxpro application under Vista when using Aero , you might encounter a problem when scrolling through lists, such as intellisense dropdowns, comboboxes, menus.

 

As you move from one item in the list to the next, each item in turn appears to be selected (colors inverted), which means the prior selected item should be unselected.

 

However, on Vista Aero, sometimes the prior items do not get painted unselected, thus showing multiple selected items.

 

There’s a simple workaround (that works back to VFP7): call the GdiSetBatchLimit API.

 

The GdiSetBatchLimit function sets the maximum number of function calls that can be accumulated in the calling thread's current batch. The system flushes the current batch whenever this limit is exceeded.

 

 

This will be fixed in the next SP release of VFP

 

The workaround is to run these 2 lines of code somewhere in your application only once.

 

DECLARE integer GdiSetBatchLimit IN WIN32API integer

GdiSetBatchLimit(1)

           

Published Thursday, April 26, 2007 11:28 AM by Calvin_Hsia
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Friday, April 27, 2007 2:38 AM by Halasz

Calvin, thank you for solution ! It works great :-)

Tom Halasz

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Friday, April 27, 2007 8:52 AM by Dominic Webb

This works, but still leaves the problem of the corrupting Window title bars (for non-resizable forms). Is there a workaround for this, and will this be fixed in SP2?

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Friday, April 27, 2007 9:47 AM by Markus Winhard

Hi Calvin,

vfp9 on vista is also not painting the NonClientArea of a form correctly if the form isn't sizable (as Dominic mentioned). The problem also occurs after the form was partly moved outside the visible area, e.g. below the lower border of the vfp screen.

I assume vista is blocking some window message. When you run vfp as administrator (e.g. from the context menu) the problem is gone.

So, is there a way around it, too?

Markus

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Friday, April 27, 2007 10:51 AM by Ricardo Almeida

Hi,

Just add this code to your INIT event of your form:

LOCAL lnBorderStyle

lnBorderStyle = this.BorderStyle

ACTIVATE WINDOW (THIS.NAME) IN SCREEN NOSHOW

this.BorderStyle = lnBorderStyle

Best regards,

Ricardo Almeida

# Fix your forms to paint borders correctly under Vista Aero

Friday, April 27, 2007 8:39 PM by Calvin Hsia's WebLog

Apparently, the borders of some forms don’t get painted correctly on Windows Vista. When executing a

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Sunday, April 29, 2007 7:04 PM by Markus Winhard

Hi Ricardo,

thank you for this tip. It turned out that it even works without setting BorderStyle again after ACTIVATE WINDOW.

Just in case someone needs a solution for forms shown in top level form, too, take a look at http://www.bingo-ev.de/~mw368/vfp9_vista.html

Markus

# Vista Aero DWM seems to optimize out GDI paint calls

Thursday, May 03, 2007 7:53 PM by Calvin Hsia's WebLog

In this post: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista I describe

# VFP9 SP2 / SEDNA USEFUL LINKS

Saturday, August 11, 2007 12:08 AM by Cesar Chalom

Here are some of the links that I often visit regarding VFP9 SP2 and Sedna. The official Microsoft Visual...

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Thursday, October 18, 2007 11:48 PM by KennethTamayo

DECLARE integer GdiSetBatchLimit IN WIN32API integer

GdiSetBatchLimit(1)

The above indeed works perfectly (at least in Windows Vista Home Premium) in AutoComplete functions, however, complying/deploying SP2 by itself did not prevent the reported display errors "showing multiple selected items"... The two magic lines were required in order to avoid this display problem.

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Friday, December 14, 2007 12:56 AM by Jim Norton

On a related issue, is there any reason why on Aero enabled (on Vista with Aero) floating forms (so those with showwindow>0) the closing 'X' (top right) is showing as enabled (red in colour) at all times, even if the closable property is false. You can't click it, but it's still red. All forms with showwindow=0 still have old style smaller 'X' boxes, and they correctly display Red or Grey to show enabled or Disabled status.

I've already applied the Combo Box and Graphic refresh fixes for Vista to the forms, but they still have the problem.

Anyone have any ideas?

# re: Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

Wednesday, March 11, 2009 1:13 PM by Daniel

This combobox bug is still not solved in 2009!

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker