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!

FoxPro Form Modal not performing modally

Status
Not open for further replies.

djhaldeman

Programmer
Mar 14, 2014
1
US
Just discovered why some FoxPro forms won't behave modally even when property windowtype is set to modal (1).

I had copied a previous form that had an object which was part of a class library. Once that object was deleted, the form behaved in a modal state the way advertised. It took a while to find that one!
 
I'm sorry, but I don't get it. Surely, every object that you place on a form is "part of a class library" (at least, every object that you place interactively). Wny would that change a modal form into a modeless form?

To be precise, the object is based on a class, which is a member of a class library.

Even if you are adding the object programmatically, I still don't get it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The only explanation I can think of is if the object itself changes the WindowType for some reason. That's perfectly possible, and it would explain the behaviour you are seeing, but it would be unsual for an object to do that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes, to support Mikes thoughts, the only modal forms never behaving modal are top level forms. By definition. Inner objects don't modify the modality.
The WindowType property is defined to be modifably at design AND run time, but there is a limit to this. The init of a class on your form would need to do that before the form init, I assume. The last chance should be before the form shows, really, after that the WindowType will not accept changes. I think you can change the modality during hide before next show of a form. Christof Wollenhaupt has shown something along that lines in his blog.

Anyway, it never is just because some control on it is from a class library. That's ridiculous. You're suggesting you can't use forms with any controls on it, which are non native controls but come from class libraries: I can assure you a magnitude of 1000 users have used such type of forms modal and non modal as expected for a magnitude of 15 years and so surely alone from me, the concept of control classes not having that impact is proven many million times.

There must be some detail you didn't dive into, it's not happening due to the shallow look about the situation you have observed.

Bye, Olaf.
 
To make a small correction to what I said earlier: every object that you place on a form is "part of a class library".

I had forgotten about the native objects. I suppose that's because I almost never place those on forms. But that doesn't alter the main point. As Olaf pointed out, the vast majority of developers use objects based on classes in class libraries, and have done for many years, and it would be inconceivable that nobody had ever noticed this behaviour before.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top