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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disappearing windows

Status
Not open for further replies.

ajpa

Programmer
Jan 31, 2002
52
GB
Under some circumstances I'm displaying a subsidiary window to warn the user of impending doom or giving them information. I've set the subsidiary window to modal and am displaying it in the top-level window. It works fine on the machine on which I develop it, even in the .exe version. But when I park it on the remote server from which users access the program, closing the subsidiary window closes the whole application down rather than returning to the top-level window.

Does this look to anyone like a common easily-solved problem ?
 
ajpa

closing the subsidiary window closes the whole application down rather than returning to the top-level window.

What is the code to close your window?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike

thisform.Hide
thisform.Release
Return

in the Click method of the terminating buttons, TerminateRead being set as false. I haven't put any code in the form's Deactivate or Destroy methods.

A thread one or two below mine mentioned Form Sets, and I'll have a look at that possibility later this evening: at present the forms are independent. But the puzzling thing is that it works fine on my base computer which is on a local network of 2 machines. It's only when it gets out onto our intranet that the problem starts.

Tony

Thanks for your response.
 
ajpa

Try using just:
Code:
THISFORM.RELEASE()

Your return is not needed. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike

I'm afraid that doesn't seem to do the trick.

As a matter of fact the problem *does* exist on my base computer when I run the .exe file from outside FoxPro. It doesn't exist when I check the 'run' option within the project builder so as to auto-run it after compilation.

Tony
 
ajpa

Ideally you should have a READ EVENTS somewhere in your main program that stops all activity until the user does something else. And when you close a window with THISFORM.RELEASE() it sould return back to the READ EVENTS. Do you have a READ EVENTS? You main program (if you are using a regular menu) should be something like this:
Code:
DO mymenu.mpr
READ EVENTS && Stops here and waits, and returns here when a window is closed.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike,

Yes, I've got exactly that in the main program. I've also got, a couple of lines earlier, ON SHUTDOWN DO CLEANUP, and the Cleanup program does

CLEAR EVENTS
RELEASE ALL EXTENDED
QUIT

There's also a CLEAR EVENTS in the Destroy and Deactivate methods of the top-level form, just to make sure.

The other thing the main program does, apart from setting icons and so on is to issue

_Screen.Visible=.F.

Maybe that's a problem, and I ought to be doing something like

Application.Visible=.F.

in the top-level form's Init method to hide the main FoxPro window. I haven't tried that yet.

I must admit that I hadn't realised that the program would return to READ EVENTS the first time *any* window closes: that would explain a lot. The documentation suggests that the program doesn't return here until CLEAR EVENTS is encountered, and there are no CLEAR EVENTS statements anywhere in my subsidiary forms, so closing them shouldn't have that effect. What I really want the program to do is to return to the point in the top-level form from which it was called.

(I had no success last night with form sets either.)

Incidentally, I notice that you are putting () after the .Release method. It seems to work just the same as .Release. Is there something I ought to know about the ()?

Tony Ayres
 

Incidentally, I notice that you are putting () after the .Release method. It seems to work just the same as .Release. Is there something I ought to know about the ()?

It is a good practice to call a method or a procedure by the accepted way of programming. Its strictly a more ledgable and understandable way of programming. If you call a method you should use the (). And the bracket also are used to send paramaters. Let assume in your form release you have a parameter that checks a certain value you woudl use:
THISFORM.RELEASE("cValue").

All this to say that the following work the same:
THISFORM.RELEASE()
THISFORM.RELEASE
RELEASE THISFORM

To get back to your problem, from here it's hard to determine, but if you app is small enough, just zip it and e-mail it to me ( at mike.gagnon@slpcanada.com), and I'll take a look at it for you.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike,

That's a very kind offer, and I'll take it up when our e-mail is working again. We got badly spammed last week and it's been out for over a week. Maybe the system administrators need to join a Tek-Tips forum!!

Tony Ayres
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top