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

x
?
Solved

Opening a long form at the top

Posted on 2002-07-02
8
Medium Priority
?
133 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
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.

 
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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

688 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