Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

restore inherited form's original bounds

Posted on 1998-12-01
9
Medium Priority
?
232 Views
Last Modified: 2010-04-04
When I create a bunch of forms based on a base form held in the repository, they all start out being the same size as the base form - until I resize the instance form.  Then the instance form has it's own bounds viz. top, left, etc. properties.

How do I tell the form to revert to using the inherited base form size?  

Similarly with components on the base form - if I move them on the instance form they forever are independent of the base form component position.  How do I tell these components to revert to the base form component's position (this applies to all the other properties, beside top,left,width etc. )
0
Comment
Question by:abulka
[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
  • 5
  • 4
9 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 280 total points
ID: 1348836
Right click on a component in the inherited form and you will see a revert to inherited optin - this will undo any changes made to the inherited component (and should work for the form itself too - though I am not sure if it changes all the components on the form as well.

Cheers,

Raymond.
0
 

Author Comment

by:abulka
ID: 1348837
You are right about 'revert to inherited' for components.  However,
The menu item is always dimmed out for forms.  How do I get the form to revert?  This is the main thing I want to get working.
-A

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1348838
OK - here we have to get crafty!

When viewing the form itself, press Alt-F12. This converts the form to text. Near the top you will see lines that say
left = x
top = y
width = z

etc.

To make the inherited form revert to the properties of the ancestor form delete the properties you want to be the same eg: deleting the top, left, width and height lines will make the inherited form take the size and position of the ancestor form.

once you have deleted these press alt-F12 again to convert the text back into a form.

Cheers,

Raymond.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:abulka
ID: 1348839
Ok that sounds good.  I'll accept the answer.

If you give me some code to get the inherited form to revert to the ancestor form's size and position prior to displaying at runtime, this will give me a RUNTIME solution (as well as the design time solution that you gave me).

I've increased the points a little.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1348840
Hmm...

This may not be the best way to do this, but you could just implement it in a TForm derived class and derive all your ancestor forms from that (either that or do it in each form - but thats yucky):

TMyForm = class(TForm)
  private
    TheTop, TheLeft, TheHeight, TheWidth : Integer;
  protected //? could be public...
    procedure Loaded; override;
end;

procedure TMyForm.Loaded;

begin
  if csInherited in ComponentState then
    begin
      TheTop := Top;
      TheLeft := Left;
      TheHeight := Height;
      TheWidth := Width;
    end
  else
    SetBounds(TheLeft, TheTop, TheWidth, TheHeight);
end;

Cheers,

Raymond.

0
 

Author Comment

by:abulka
ID: 1348841
Looks good - just one last question.

Wouldn't I have to call
  inherited
in the TMyForm.Loaded;    of the ancestor/base form?
or is the loaded message just for notification and I don't have to pass it up?

e.g.

procedure TMyForm.Loaded;
     inherited; // parameters here???      
      begin
        if csInherited in ComponentState then
          begin
     etc...
     ...
       
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1348842
Yes. I forgot to include that.

Cheers,

Raymond.
0
 

Author Comment

by:abulka
ID: 1348843
Ok.  Does the inherited call need parameters?  e.g. sender or something?
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1348844
No - it shoudln't. It should compile just fine as it is. If not change it to:

Inherited Loaded;

Cheers,

Raymond.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

721 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