Solved

Opening a long form at the top

Posted on 2002-07-02
8
132 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
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7125559
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
ID: 7125567
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
ID: 7125789
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
Independent Software Vendors: 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 14

Expert Comment

by:DragonSlayer
ID: 7125807
Try setting the ActiveControl of your form :)
0
 
LVL 3

Author Comment

by:jdthedj
ID: 7126354
Hi DragonSlayer - Sorry! that does not work
0
 
LVL 7

Accepted Solution

by:
Cynna earned 50 total points
ID: 7126545
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
ID: 7127970
Thanks Cynna - it works perfectly!

John
0
 
LVL 7

Expert Comment

by:Cynna
ID: 7128123
You're welcome.

Cy.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
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 …
Suggested Courses
Course of the Month7 days, 1 hour left to enroll

622 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