?
Solved

Modal form positioning

Posted on 2003-03-18
4
Medium Priority
?
206 Views
Last Modified: 2010-04-04
I have a project where the user calls up an options form, i would like this form to appear in a position reletive to the main form regardless of where it is on the screen.
Little help?
0
Comment
Question by:chris51179
[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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:Stefaan
ID: 8157904
Hi,

I think setting the Position property of the for to poMainFormCenter will make your Modal form appear centered in the MainForm wherever the main form is on the screen.

Regards,


Stefaan
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 8157915
a sample

unit show_positioned_form_modal_u1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  show_positioned_form_modal_u2; //this form should be showed modal

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TForm2.Create(self) do
  begin
    top := edit1.ClientOrigin.y;
    left := edit1.ClientOrigin.x + edit1.Width;
    showmodal;  //is allways shown just right of edit1
    release;
  end;
end;

end.

meikl ;-)
0
 

Author Comment

by:chris51179
ID: 8158008
Thanks guys, setting the top and left properties acheived the effect, seems that one was just too easy for you fellas. but if i dont ask i'll never know!
0
 

Author Comment

by:chris51179
ID: 8158018
Fantastic response and lightning fast!!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month13 days, 10 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