Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-02

Patch for drawing the designer grid in Windows Vista Classic mode

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kostas Michalopoulos

In a previous mail i wrote a few months ago i mentioned the issue that Lazarus has with Windows Vista when both Aero and visual styles are turned off (which is the case when the Classic theme is used). I decided to dig into a bit today since nobody seemed to figure out a solution (it is still there in rev 18800) and i attached a patch that fixes it.

However i'm not sure if this is the best way to handle the issue.

The problem seems to be in Vista: the clip region isn't used correctly with SetPixel when both aero and visual styles are off and large parts of the region are clipped. Enabled a visual style (like the Visual Basic theme) or Aero fixes this problem, but many users (including me) prefer the Classic theme. So i replaced the call to DrawGrid, which uses SetPixel, with code that draws the grid using a 1 pixel Rectangle. The process unfortunatelly is much slower and in order to avoid messing with other OSes which work without a problem, i added a {$IFDEF WIN32} in there. Also even in Windows, this only happens in an exceptional case: Windows Vista with the Classic theme. I believe it works in every other version of Windows (Win7 not tested). So probably extra some code should be written to avoid this "fix" when Vista is in Aero or uses a Visual Style or some other version of Windows is used. For starters this might need to be moved in DrawGrid function - but i didn't do this because DrawGrid expects Pen settings while i had to use Brush. Beyond that, somewhere in the WidgetSet's initialization a check should be done for the OS and set a flag that DrawGrid will check to see if it should sue Rectangle or SetPixel depending on the OS version and settings.

These are do-able of course, but i thought to release a patch for those who experience the problem and want a fix.

Kostas "Bad Sector" Michalopoulos
PS. I also have another problem: the whole screen flickers like mad - basically everything gets redrawn - when the grid is drawn. This happens with other programs too, so its not a Lazarus-specific issue. However i wonder if anyone knows about a solution.

Reply by email

Kostas Michalopoulos
to Paul Ishenin

I explained that in my first mail: DrawGrid expects a Pen to be set up while I use a Brush. Also its not a fix for the DrawGrid problem (although that's what it should be fixed) in general, but for the specific problem I had with Vista + no Aero + no Visual Styles. Unfortunately I cannot work on it right now until I figure out why the screen flashes so much without visual styles and aero (it happens not only with Lazarus but with many other programs). If anyone wishes to look into it, I've explained in the first main what I would do.

--------------------------------------------------

Earlier message 16 lines
From: "Paul Ishenin" Sent: Monday, February 23, 2009 11:27 AM To: "General mailing list" Subject: Re: [Lazarus] Patch for drawing the designer grid in WindowsVistaClassicmode > Kostas Michalopoulos wrote: >> And the patch file > Why are you trying to fix designer.pp file? DrawGrid is a widgetset > dependent method. Try to fix TWin32WidgetSet.DrawGrid instead. > > Best regards, > Paul Ishenin. > _______________________________________________ > Lazarus mailing list > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email