Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange problem with modal forms and Application in top-level form

1,223 views
Skip to first unread message

Bogdan Zamfir

unread,
Jul 21, 2002, 9:16:48 AM7/21/02
to
Hi,

I encountered a very strange problem.
My application uses a top-level form as main form (default VFP form is
hidden).
Although I use modeless, multi-instance forms, sometimes I need to open a
modal form.
But I discovered a very unleasant behaviour: when I have my modal form open,
even if I cannot change focus to one of those modeless forms already open
(as expected), I can start another form from menu (the application menu
isn't disabled). By doing this, the new open form is opened as modal (even
if the code from menu try to open it modeless), and I cannot access any
other form till I close the latest one (the one open from menu)

This is not happening if I use VFP main form as application form, but right
now I cannot change my application to do this (the framework I use uses
top-level forms for main application form)

This is very unpleasant, and I cannot find any way to fix it.
I'm waiting for any advice, and any help will be appreciated.

Best regards,
Bogdan


Raymond Hartman

unread,
Jul 21, 2002, 4:42:58 PM7/21/02
to
as far as making the menu not available when you have a modal form open, you
need to put code in the menu to evaluate to false to make menu selections
unavailable.

when modal forms are active you should not be able to access any modeless
forms.

"Bogdan Zamfir" <a...@fx.ro> wrote in message
news:Og$nTjLMCHA.1928@tkmsftngp13...

Trevor Hancock [MS]

unread,
Jul 22, 2002, 10:26:58 AM7/22/02
to
Bogdan,

What version of VFP are you using? Are the sub-forms set as IN TOP-LEVEL or
AS TOP-LEVEL? Are you using "IN TOP-LEVEL" and the DESKTOP property?

In both VFP6 and 7 I created a top-level form with a menu and two "in
top-level" forms, one modal and one not. When built into an .EXE and run, I
can open the modal form and see that the menu is disabled.

Perhaps you can supply a sample or more detailed instructions on what you
have there?

Trevor Hancock, MCSD
Microsoft Developer Support - FoxPro

Upgrade to VFP7 today! Once you've used it... you'll NEVER go back:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=10950

This posting is provided “AS IS” with no warranties, and confers no rights.

Bogdan Zamfir

unread,
Jul 22, 2002, 8:07:44 PM7/22/02
to
Hi,

> as far as making the menu not available when you have a modal form open,
you
> need to put code in the menu to evaluate to false to make menu selections
> unavailable.

But this should be done automatically by VFP I think. Modal form should
disable all menus (but unfortunately it shouldn't).

> when modal forms are active you should not be able to access any modeless
> forms.

I know this. And, if I have any modeless form already open when I open the
modal form, of course I cannot access it.
BUT (this bug BUT) I am able to select an option from menu (and I think I
shouldn't), and this menu option can open a modeless form (which, in this
case act as a modal one, so till I close it I cannot access any other form).

Did anyone alse tested and encountered this strange behaviour?
Any workaround?

Regards,
Bogdan

Fred Taylor

unread,
Jul 22, 2002, 8:49:19 PM7/22/02
to
Where are you activating your menu from? If you call a modal form from the
menu (and do not do anything to the menu), the menu should not be accessable
from within your modal form. That's the way it works for me, anyways.


--

Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.

Bogdan Zamfir wrote:
:: Hi,


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.377 / Virus Database: 211 - Release Date: 7/15/2002


Martin Lam

unread,
Jul 24, 2002, 9:47:00 PM7/24/02
to
Hi Bogdan,

I had exactly the same problem as yours and I posted a message here days ago
for helps. Unfortunately, the problem has not been really solved yet. I
have some observations:

1. This happens when the 2nd form is called from the top menu, i.e., the
1st level of the menu. One possible solution is to avoid calling any form
from the top menu. Always do this from sub-menus.

2. Don't expect VFP7 may have solved this problem. VFP7 behaves exactly
the same.

Martin Lam

"Bogdan Zamfir" <a...@fx.ro> wrote in message
news:Og$nTjLMCHA.1928@tkmsftngp13...

Bogdan Zamfir

unread,
Jul 24, 2002, 8:30:45 PM7/24/02
to
Hi Martin,

> I had exactly the same problem as yours and I posted a message here days
ago
> for helps. Unfortunately, the problem has not been really solved yet. I
> have some observations:
>
> 1. This happens when the 2nd form is called from the top menu, i.e., the
> 1st level of the menu. One possible solution is to avoid calling any form
> from the top menu. Always do this from sub-menus.
>
> 2. Don't expect VFP7 may have solved this problem. VFP7 behaves exactly
> the same.

Thanks for your reply.
I'm working with VFP7 actually, so ...
My question is, there is anyone around who solved this issue (or knows any
workaround)?
I cannot move all code who open forms on 2'nd menu level.

Anyone from MS around, to give use some help?

Regards,
Bogdan

Leonid

unread,
Jul 25, 2002, 3:51:26 AM7/25/02
to
Hi, Bogdan

You can use public variable m.modal_form. In Init or Load method of your
baseform class (I suppose that you have one) put code

if Thisform.windowtype=1
m.modal_form=.t.
endif

and in destroy method

if Thisform.windowtype=1
m.modal_form=.f.
endif

Then in menu you can use skip for m.modal_form

Leonid

"Bogdan Zamfir" <a...@fx.ro> wrote in message

news:eAZt8J3MCHA.2480@tkmsftngp12...

Bogdan Zamfir

unread,
Jul 26, 2002, 8:09:28 AM7/26/02
to
Hi,


"Fred Taylor" <fta...@mvps.org> wrote in message
news:ugVExJeMCHA.2636@tkmsftngp09...


> Where are you activating your menu from? If you call a modal form from
the
> menu (and do not do anything to the menu), the menu should not be
accessable
> from within your modal form. That's the way it works for me, anyways.

The menu is opened in the framework in the method who start application
(after the main application form was instantiated).
The modal form is not open directly from the menu, but from a modeless form.
And I use to open modal forms in two different ways:
Some times the form is designed as modal, and I open it with DO FORM
<myform> with <paramlist> to <retval>
Some other time I open the form like this

do form <myform> name loForm linked noshow
* set some properties / run methods, etc
....
loForm.Show(1)


Then in form I have OK -Cancel who make them invisible when the processing
was done, and this continue the code after Show(1) call.

But either one way or another, the menu is accessible when the modal form is
visible (unlike any other modeless form, which are not accessible).

Regards,
Bogdan

Bogdan Zamfir

unread,
Jul 26, 2002, 8:10:14 AM7/26/02
to
Hi,

> You can use public variable m.modal_form. In Init or Load method of your
> baseform class (I suppose that you have one) put code
>
> if Thisform.windowtype=1
> m.modal_form=.t.
> endif
>
> and in destroy method
>
> if Thisform.windowtype=1
> m.modal_form=.f.
> endif
>
> Then in menu you can use skip for m.modal_form

Thanks for your suggestion.
My menu is preety big, and I have to add this for each menu on frst level.
But I'll try.

Regards,
Bogdan


"Leonid" <leo...@grada.lv> wrote in message
news:ukn5E$6MCHA.2276@tkmsftngp10...

Fred Taylor

unread,
Jul 26, 2002, 11:02:53 AM7/26/02
to
Are you sure the modal form itself isn't reactivating the menu somehow?
Normally, a modal form will disable any existing menu and can't access it.


--

Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.

Bogdan Zamfir wrote:
:: Hi,
::
::
:: "Fred Taylor" <fta...@mvps.org> wrote in message

Stephen Lee

unread,
Jul 26, 2002, 7:31:36 PM7/26/02
to
The menu is not and should not be disable when a modal form is open. I
should still be able to access the EDIT menu and COPY a string when I'm in a
MODAL form.

"Fred Taylor" <fta...@mvps.org> wrote in message

news:OECJsVLNCHA.772@tkmsftngp12...

Fred Taylor

unread,
Jul 26, 2002, 8:01:26 PM7/26/02
to
Not really. You can only access those things if the menu was created and
started from within the modal form. If it already existed when the form was
started, you can't access those features.


--

Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.


Stephen Lee wrote:
:: The menu is not and should not be disable when a modal form is open.

Bogdan Zamfir

unread,
Jul 28, 2002, 4:44:51 PM7/28/02
to
Hi,

> Are you sure the modal form itself isn't reactivating the menu somehow?
> Normally, a modal form will disable any existing menu and can't access it.

Yes, I am.
I have no code in modal form who affect the menu in any way.
But, as I mentioned, this strange behaviour appears only when the main
application form is a top-level form different then VFP main form. If I use
VFP own window as main application form, this strange thind doesn't occur,
and the menu is acting as expected (disabled when modal form is opened)

Fred Taylor

unread,
Jul 28, 2002, 5:24:15 PM7/28/02
to
That's because if you're using your own form as a top-level form, there is
no concept of modal. You can only have forms that are activated from within
your top-level form be modal. Your top-level form can not be modal.


--

Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.

Bogdan Zamfir wrote:
:: Hi,
::
::: Are you sure the modal form itself isn't reactivating the menu

Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002


Bogdan Zamfir

unread,
Jul 30, 2002, 4:13:42 PM7/30/02
to
Hi,

> That's because if you're using your own form as a top-level form, there is
> no concept of modal. You can only have forms that are activated from
within
> your top-level form be modal. Your top-level form can not be modal.

Maybe I wasn't very clear.
My application is a MDI application. Its main form is a top-level form
different then default VFP window (_screen). _screen is hidden during
application run.
On my main form I have a menu, with several options. From this menu I start
different procedures, who open different forms, depending on what I need to
accomplish. Most of those forms are modeless, and hosted inside of my main
form (top level one). But sometimes I need to open some modal forms (to view
properties about a record, to open allication options form, printer
configuration form, etc). No matter how I open those modal forms (either
from a procedure called directly from menu, or by clicking a button on any
modeless form), I am still able to access application menu, and start other
procedures (which, in turn, can open other, modeless forms), which shouldn't
happen. On the other hand, while the modal form is open, I cannot access
another modelelss form, as expected (this is correct).

Fred Taylor

unread,
Jul 30, 2002, 4:26:00 PM7/30/02
to
I'm sorry, I've never found it useful to me to do away with the VFP _SCREEN
form. I'm proud that my app is FoxPro, and I don't try to go out of my way
to hide it. I could look at this in further detail, but I do not have the
time to create an entire app within my own top-level form.

BTW, MODAL works as expected within a _SCREEN top level. You might have to
reconsider your choice, or find a different approach.

PC-CASH-TEAM

unread,
Aug 20, 2002, 5:52:56 AM8/20/02
to
Oh yes, I have the same problem.
But: not on any pc, only on one of 10 pc´s.
It happens only, when I start from the IDE., if I compile and build an
EXE-File it works fine.
Thomas
0 new messages