Solved

Show a PasswordDlg

Posted on 1997-05-24
3
368 Views
Last Modified: 2012-06-27
I want a PasswordDlg appears immediately after form1 created.
Where I should put the statement, PasswordDlg.ShowModal?
I don't want to put it in a button Onclick event, I want that is automatically done.
I don't want to put it in the Onpaint event of form1, since whenever the form repainted PasswordDog would appear again.
0
Comment
Question by:zhuhail
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
sleach earned 40 total points
Comment Utility
If you want the Pass Dialog shown before the form is displayed, place it in the OnCreate event of the form.

If you want the Pass Dialog shown after the form is displayed, but before the user can do anything, place it in the OnActivate method, and set a global flag so that it is only displayed the first time the event occurs.

0
 

Author Comment

by:zhuhail
Comment Utility
Thank you.

I have tried to put PasswordDlg.ShowMadal in OnActive event of Form1. That worked fine. However, when put that in OnCreate event of Form1, I got an error message:
'Access violation at address 0041DC8F. Read of address FFFFFFFF'
What is the message means?
0
 
LVL 1

Expert Comment

by:sleach
Comment Utility
PasswordDlg must be a delphi form.  I used a MessageBox to test.  The problem is that PasswordDlg is not the first form created.  Your main form is.  Therefore your trying to ShowModal a form that has not yet been created.

The solution is to create the PasswordDlg form at runtime.
REMOVE PasswordDlg from the projects AutoCreate list with the project manager.  Then Create the form at runtime.  An example of how to do this is below.

procedure TForm1.FormCreate(Sender: TObject);
var
PasswordDlg:  TPasswordDlg;
begin
PasswordDlg := TPasswordDlg.create(self);
PasswordDlg.ShowModal;
end;

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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…

772 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