?
Solved

Overriding Left property..

Posted on 2001-08-07
6
Medium Priority
?
233 Views
Last Modified: 2010-04-06
In the question
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20164439
The problem of being notified when the left property is changed is raised. In particular, when placing the component in the form, I would like to have an event happen or an overriden Setleft procedure. I hope experts will try to answer that question..
0
Comment
Question by:karouri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6359379
listening . . .
0
 
LVL 4

Expert Comment

by:fva
ID: 6359576
If you take a look at the VCL code you will notice lots of references to the Left property of all kinds of derivatives to TControl/TWinControl and that means you are not safe by just overriding SetLeft without making it virtual in the first place (in TControl).
Since the design of VCL does not allow for overriding properly the SetLeft (as a virtual method) I guess you're stuck. The quick hack would be to take the VCL source, change the definition of SetLeft in TControl to be a protected virtual method and then derive it to your pleasure. Of course, it has the drawback of a fully "custom" VCL which might cause you all kind of other problems and it might be a little tricky to get it compiled.

F.
0
 
LVL 4

Accepted Solution

by:
fva earned 1200 total points
ID: 6359616
And yet I might be wrong.

Suggestion 1:
Capture the WM_WINDOWPOSCHANGED message. This one should be sent by Windows when the pos changes and it _is_ sent by VCL to self when SetBounds is called, but with fake params.

Suggestion 2:
Override SetBounds itself (which is virtual already in TControl) and devise your own logic to detect the wanted change.

F.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:fva
ID: 6359647
If you think any of the above is worth and you need further details, please say so.

F.
0
 
LVL 3

Author Comment

by:karouri
ID: 6360346
Actually both of your suggestions are sensible.
I have tested SetBounds overriding and it works, so I give you the points, though it is much more probable that I will capture the message in my work.
I have refrained from using SetBounds in the past because it does not allow you to modify Left or Top, while OnConstrainedResize is not conerned with Left and Top to modify them. The amazing thing is all you need is to pass your own values to inherited SetBounds..Sometimes one just,umm, oversee things;)
* Just to know, Can one modify the values of the WINDOWPOS record passed in the message to change Left or Top?

btw, I increased the points a little because it was very important to me and, well I have some points to spare
0
 
LVL 4

Expert Comment

by:fva
ID: 6360408
Thanks.

You should use WM_WINDOWPOSCHANGING to adjust the values. By the time WM_WINDOWPOSCHANGED comes in I think it would be too late to require a change.

F.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question