Steve Trefethen
Contact me
About Me View my LinkedIn profile

Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
Need consulting?
Need Consulting?

Spread Thunderbird

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

TestComplete Keyword Testing Online Training

I will be presenting a three day webinar April 12-14th 2010 from 9am-1pm PST on AutomatedQA's TestComplete. The cost is $499/person and you can register on Falafel Software's website here. For detailed information on this training click here.

VCL Forms that snap to the edge of the screen

October 26 2006 8:14AM
I was just reading this article over on delphi.about.com about getting forms to snap to the edges of the screen. Since at least Delphi 7 this functionality has been built into the VCL and is available through two properties on TCustomForm called ScreenSnap and SnapBuffer.
  • ScreenSnap is a boolean and toggles the feature on/off.
  • SnapBuffer is the distance in pixels from the edge of the screen that you want snapping to occur, the default is 10 pixels.
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

Comments

10/31/2006 12:21:11 AM #

David M

This is cool to have in the VCL, but as far as I know it doesn't snap to other forms or windows, only the screen edges.  So someone who wants form snapping still has to implement half of it.

(Not that I'm complaining, even half is good!  It's a nice inbuilt feature.)

David M

10/31/2006 12:25:43 AM #

Steve Trefethen

Hi David,
  The other "half" (in your words) has been written it's just that some interesting issues arise when you start allowing forms to snap to one another like what happens when you drag or resize the snapped forms. Until we satisfactorily work through those issues that probably won't surface in the core VCL.

-Steve

Steve Trefethen

4/26/2007 5:05:31 PM #

Andrew

Hi, the Snap function in Delphi is buggy! Yea!

Just do this simple exercise: Put your TaskBar on the Right or on the Top of your Screen, and try to snap to them. It won't work.

The inside code shipped in Delphi 7 is:
      HandleEdge(x, Left, Monitor.WorkareaRect.Left);
      HandleEdge(y, Top, Monitor.WorkareaRect.Top);
      HandleEdge(x, Right, Width);
      HandleEdge(y, Bottom, Height);

But it should be:
      HandleEdge(x, Left, 0);
      HandleEdge(y, Top, 0);
      HandleEdge(x, Right, Width);
      HandleEdge(y, Bottom, Height);

Greetings!!

Andrew

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Spam filtering provided by: Spam Counter
333 comments approved, 1463 spam caught since October 28, 2009
Powered by Commentor