Odd modal form behaviour

Hi Experts

A curious question that I wonder if somebody has encountered before.

I have a normal app (D7).

Create a new Project with two forms Form1 and Form2

Make Form1 your startup form

On Form1 place a button.

Under the button put this code


Run the project and click the button, Form2 show modally.

Everything looks fine.

Now I have a cheap mouse with a neat menu system.  I click a button on the side and a menu pops up.

Funny thing happens, in my Delphi project, my modal form ducks behind the main form and the main form is inactive.

I have probably a hundred apps on my PC and don't have this problem with any other apps.

The solution is easy - get a new mouse?

But here's the problem, what if my clients have the same problem with another mouse?

Anybody got any idea what's happening?

The app exhibits the same behaviour on NT and Win2000

Who is Participating?
Computer101Connect With a Mentor Commented:
PAQed with points refunded (100)

EE Admin
you have already posted the same question below.

i can't reproduce your problem, maybe its a feature, not a bug.
sorry, can't help

meikl ;-)
Hi, try setting Form2's property FormStyle:=fsStayOnTop;

maybe it should help, regards,
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.

VoodoomanAuthor Commented:

Hi Meikl

Yes I did post the problem before but it did not appear in the list for some reason and so I had no responses.

I posted to support about the 'no show' so maybe they fixed the reason it was not showing.

This is the reason I posted again as I figured their was some problem with my first question.

Maybe it's a problem with the mouse driver, but I do not have this problem with any other software only my own software developed with D7.

Its a Borland bug of some kind (I think so anyway).

As you can see I can reproduce the probelm on 2 x machines by simply creating a new project with just two forms and standard controls.

Strange but true

>Its a Borland bug of some kind (I think so anyway).
well, could be, d3 had a bug with the mousewheel (with a specific driver (logitech i guess)),
so maybe this a borland bug too

will try a second setup on a different machine

meikl ;-)
VoodoomanAuthor Commented:

Thanks Meikl

I have had problems in the past similar to this (only with Delphi D7).

Before I had problems with other application forms getting in between my main form and modal forms.

In my app I made the main form the splash.

Then I hid the splash (main form) and showed my 'main working screen'.

This caused all kinds of problems

It would happen like this.

User cliks 'add rec' or something and I

1) Hide the main screen (remember this is not the main Delphi form)
2) show the 'addrec form' modally
4) show a form modally over the 'addrec form', 'SelectClientForm'

In this scenario if I went to check my E-Mail and after clicked on the toolbar Icon to swap to my app I would retrieve the last modal form 'SelectClientForm' but the 'addrecform' would not be visible behind it as expected, only the Outlook Screen would be visible.

The project was dropped so I didn't experiment anyfurther.

However I have just looked at another project completed some months ago and that exhibits the same behaviour that I am experiencing now!!!!!!!!

I press button 5 to access my mouse menu 'off my modal form' and my modal form drops behind my main delphi form.  

If I select any item off the mouse menu the form reappears, if I click away from the mousemenu to cancel it the form remains hidden behind my main form.


sorry, got no time yesterday, will try this evening
VoodoomanAuthor Commented:


VoodoomanAuthor Commented:

I found out the answer to this problem myself.

It concerns how you create the form.

If you use this the problem does not occur:

Var F_Login:TF_Login;



However if you use this the problem does occurr:



With this latter consturcyion, other forms from other brograms can 'get in between' the showing form and the modal form - strnage but true.

Apologies for not closing this myself and taking your time.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.