Partager via


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)

Comments

  • Anonymous
    April 26, 2007
    Calvin, thank you for solution ! It works great :-) Tom Halasz

  • Anonymous
    April 27, 2007
    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?

  • Anonymous
    April 27, 2007
    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

  • Anonymous
    April 27, 2007
    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

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

  • Anonymous
    April 29, 2007
    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

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

  • Anonymous
    August 10, 2007
    Here are some of the links that I often visit regarding VFP9 SP2 and Sedna. The official Microsoft Visual...

  • Anonymous
    October 18, 2007
    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.

  • Anonymous
    December 13, 2007
    The comment has been removed

  • Anonymous
    March 11, 2009
    This combobox bug is still not solved in 2009!