Link to home
Start Free TrialLog in
Avatar of Voodooman
Voodooman

asked on

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

Form2.showmodal:

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


Voodooman
Avatar of kretzschmar
kretzschmar
Flag of Germany image

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,
Kate
Avatar of Voodooman
Voodooman

ASKER


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

Voodooman
>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 ;-)

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.

Voodooman



The
sorry, got no time yesterday, will try this evening

Thanks


Voodooman
Hi

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;

F_Login:=TF_Login.create(Nil);

F_Login.ShowModal;

However if you use this the problem does occurr:

Application.CreateForm(TF_Login,F_login);

F_Login.showmodal;

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.


Voodooman
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial