Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is modal form always modal?

Status
Not open for further replies.

Toman

Technical User
Mar 30, 2004
190
CZ
In a VFP 7 application I've a modal form (WindowType = modal, WindowState= normal, ShowWindow = In Screen).

Everything works as expected - no other forms can become active and the menu is inactive. But there is in menu bar one item in my menu with no submenu which has a command "DO FORM frmMyOtherForm" connected. To my surprise this command can be executed and modal character of previous form is overcame - very dangerous indeed.

What should I do better?
Thank you, Tom
 
Is this form a part of a form set?

Is frmMyOtherForm, by any chance, is a child of your modal form?

Or did you try this in a development environment with the program suspended?
 
To Stela

- No , my modal form is standalone form, there are no formsets in this app
- No, frmMyOtherForm is not a child of my modal form
- The behavior is the same in development environment and in run time. The program is not in suspended state.

Thank you for trying to help me.
Tom.
 

Tom,

A bit of a long shot, but is it possible that, when you created the menu, you used a bar number for the menu item in question? In other words, instead of setting the result column to "Command" or "Procedure", you set it to "Bar #"?

If so, that might conceivably explain the problem, although I admit it's unlikely you'd have done that by mistake.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Tom.

To my surprise this command can be executed and modal character of previous form is overcame - very dangerous indeed.

This has been the case every since I can remember.

If you do not want to take this item and move it from the menu pad to a submenu, you may want to put something like this in the SKIP FOR clause:

Code:
TYPE( [_Screen.ActiveForm.Name] ) = [C] AND _Screen.ActiveForm.WindowType = 1

Marcia G. Akins
 

Tom,

Reading Marcia's post, I see something I missed the first time - the menu item in question is in the main menu bar, not a submenu. That would entirely explain the behaviour you are seeing. Ignore my comment about bar numbers.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Sorry, sorry,
I haven't noticed the last posts, this forum is so quick ..

Well, now everything is clear to me. One must be aware if using modal forms. For me a surprise after 12 years living with VFP. A bad pupil probably.

The solution is not to call "destructive" forms from the main menu bar or make some other disposals according to Marcia's recommendations.

I thank very much to all.
Tom.
 

Tom,

The solution is not to call "destructive" forms from the main menu bar

Actually, I make it a rule never to do anything from the main menu bar. All my top-level menus just open a submenu. I don't know if that's the recommended Windows behaviour, but it seems like a good practice to me.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I don't know if it's recommended, but it certainly seems to be the practise. <s>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top