Board index » delphi » Non-Modal Form

Non-Modal Form


2003-10-03 06:07:02 PM
delphi123
Can you tell me how to create a non-modal form in an application. I can
get other programs to run e.g. calculator in a shell but cann't seem to
find the necessary Show command.
Thanks
 
 

Re:Non-Modal Form

Using just the show the form flashes on and closes stright away.
I want the form on screen so users can refer to the information while
switches in the main application to other screens.
George Christoforakis writes:
Quote
Form1.Show will open the form in a non-modal way.
The FormStyle should not be fsStayOnTop.

Do you mean by using the ShellExecute?

George Christoforakis


"chris ross" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>Can you tell me how to create a non-modal form in an application. I can
>get other programs to run e.g. calculator in a shell but cann't seem to
>find the necessary Show command.
>
>Thanks
>



 

Re:Non-Modal Form

Form1.Show will open the form in a non-modal way.
The FormStyle should not be fsStayOnTop.
Do you mean by using the ShellExecute?
George Christoforakis
"chris ross" <XXXX@XXXXX.COM>writes
Quote
Can you tell me how to create a non-modal form in an application. I can
get other programs to run e.g. calculator in a shell but cann't seem to
find the necessary Show command.

Thanks

 

Re:Non-Modal Form

You can leave the form open (don't close it, or disable the close/minimise
buttons) and put it somewhere else on the screen or use an MDI application.
George Christoforakis.
"chris ross" <XXXX@XXXXX.COM>writes
Quote
Using just the show the form flashes on and closes stright away.

I want the form on screen so users can refer to the information while
switches in the main application to other screens.
 

Re:Non-Modal Form

chris ross writes:
Quote
Using just the show the form flashes on and closes stright away.
Is it closing or just getting hidden behind other forms?
If you are calling Show then it will not close on its own unless you are
doing something to close it (like calling Free after calling Show?).
If you want it to stay visible while user uses other forms then set the
StayOnTop style in the form properties.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
 

Re:Non-Modal Form

I am freeing it, but this is standard code to free the resources and
should only be executed once the user closes the form.
I'll recheck the code and try the StayOnTop style.
Ta
Wayne Niddery [TeamB] writes:
Quote
chris ross writes:

>Using just the show the form flashes on and closes stright away.


Is it closing or just getting hidden behind other forms?
If you are calling Show then it will not close on its own unless you are
doing something to close it (like calling Free after calling Show?).

If you want it to stay visible while user uses other forms then set the
StayOnTop style in the form properties.

 

Re:Non-Modal Form

Hi Bill,
I have stepped through the code and I am only getting to show and then
there is the Finally... in which I free the resources. This should
only be activated by the User closing the form, correct?
So it shows, then I press F7 in debug mode to move on a line and it
steps into the finally clause. I have not clicked on anything iin the
form to request a closure.
Any ideas?
Bill Todd writes:
Quote
If the form closes immediately something in your code is closing it.
Set a breakpoint on the Show call and step through your code.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
 

Re:Non-Modal Form

Okay.., so in that case I am probably looking at this issue the wrong way.
My Insurance Database application uses modal forms throughout, however,
what I wanted to create was a utility or other form that could stay open
while the main application is running so that the Users could refer to
the information on it. I thought I could do this by showing a form but
in a non-modal state so it would be independant to the main processing
of the application. Am I of course here? How can I acheive the desired
results?
Bill Todd writes:
Quote
On Thu, 09 Oct 2003 15:55:16 +0200, chris ross
<XXXX@XXXXX.COM>writes:


>This should
>only be activated by the User closing the form, correct?


No. That is not correct. When you call Show the form is non-modal and
your code continues to execute. When you call ShowModal execution
stops on the call to ShowModal until the user closes the form.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)