Solved

Opening a long form at the top

Posted on 2002-07-02
8
127 Views
Last Modified: 2010-04-04
Hi

I have a data entry form which is longer than one screen.  When the form opens, it opens at the bottom instead of the top.  

I have tried Contact_Name.SetFocus which now opens the form near the top, but there are some lines of text in TLabels above the first control, and also a couple of buttons which are not able to be seen.

How do I get the form to open right at the top?

Regards
John
0
Comment
Question by:jdthedj
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 44

Expert Comment

by:CrazyOne
Comment Utility
I am not sure I understand what you are asking but try this MyForm.Top := 0;


The Crazy One
0
 
LVL 3

Author Comment

by:jdthedj
Comment Utility
Hi Crazy One

I don't need the form to be at position 0,0 on the screen - I need the form to open with the topmost controls showing at the top of the form.  At the moment the controls in the middle of the form are at the top when the form opens, so that the controls above that are not seen and the user must scroll up to see them.

John
0
 
LVL 44

Expert Comment

by:CrazyOne
Comment Utility
Hmmm well I guess what you would need to do is write a routine to calculate the difference between what component you want to have shown at the top of the screen and the distance in pixels between it an the top of the form. Of course if the component is parented to something other then the form then you would have to work in with the calculation the parent of the component.
0
 
LVL 14

Expert Comment

by:DragonSlayer
Comment Utility
Try setting the ActiveControl of your form :)
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Author Comment

by:jdthedj
Comment Utility
Hi DragonSlayer - Sorry! that does not work
0
 
LVL 7

Accepted Solution

by:
Cynna earned 50 total points
Comment Utility
jdthedj,

Let's say this happens with Form1. Try this:

var
MoveToTop: Boolean; // Global var

procedure TForm2.FormShow(Sender: TObject);
begin
  MoveToTop:=TRUE;
end;

procedure TForm2.FormPaint(Sender: TObject);
begin
  // This actually moves contens of the form on the top:
  if MoveToTop then VertScrollBar.Position:=0;
  MoveToTop:=FALSE;
end;
0
 
LVL 3

Author Comment

by:jdthedj
Comment Utility
Thanks Cynna - it works perfectly!

John
0
 
LVL 7

Expert Comment

by:Cynna
Comment Utility
You're welcome.

Cy.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now