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

mappoint control - cannot quit foxpro error

Status
Not open for further replies.

Imaginecorp

IS-IT--Management
Jan 7, 2007
635
US
I have a form that displays a saved map. I do this by using ADDOBJECT() to the form.
Code:
If Vartype(This.Reg_mapcontrol1) # "O"
	This.AddObject("Reg_mapcontrol1","Reg_mapcontrol")
Endif
oMap = Addbs(Sys(5)+Sys(2003))+'new map.ptm'
*!*	oMap = Addbs(Justpath(Sys(16)))+'new map.ptm'
With This.Reg_mapcontrol1
	.NEWMAP(oMap)
	.Toolbars.Item("Navigation").Visible = .T.
	*.Toolbars.Item("Standard").Visible = .T.
	.Left = Thisform.reg_shape1.Left
	.Top = Thisform.reg_shape1.Top
	.Height = Thisform.reg_shape1.Height
	.Width = Thisform.reg_shape1.Width
	.Visible = .T.
	.ActiveMap.zoomin
Endwith
Every thing works fine.
In the forms DESTROY() I have:
Code:
	If Vartype(.Reg_mapcontrol1) = "O"
		This.Reg_mapcontrol1.closemap
		This.RemoveObject("Reg_mapcontrol1")
	Endif

when done , when i try to exit the app, I get the "Cannot Quit..." window

Now the strange part: ONLY If the user manuplates the map using the mouse i.e. zoom or pan etc, and opts to either save or Not save the map, I do not get the error

The apps On Shutdown does everything i.e. release clears etc. I dont see anything "hanging" when I display memory etc. Cant Fig this out...
 
I'm guessing your form's DESTROY() method is RETURNing .f., which prevents the form from destroying, and will cause the CANNOT QUIT message.

I'd move that code from the form's Destroy() method to Release(). The objects on the form have already been released by the time Destroy() happens.
 
Thanks Dan; Just tried it did not work. We never caught this as the users would always manipulate the map i.e. get directions, distances time etc. But there is always one that didn’t…
Prior to releasing it we would set the Mapcontrol 'Saved' Property to .T., so changes could not be saved.
I am totally stumped...Any other ideas would be greatly appreciated…
 
Just a guess .... Could it be that the form is going modal at some point? If so, that would explain the "cannot quit" message (although it wouldn't explain why it happens in some cirucumstances and not others).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
>Prior to releasing it we would set the Mapcontrol 'Saved' Property to .T.

I don't see that here, so why don't you add it to the destry or release code, if that works?

Bye, Olaf.
 
Have you looked at:
Avoiding 'Cannot Quit Visual Foxpro' on Shutdown
faq184-4277

Good Luck,
JRB-Bldr
 
Thanks guys; good to see ALL the old crew...

VFP will not allow "Quit" Re: shutdown
Yes, the "Saved = .t." is not posted but it is there.
I have debuged and debuged and the form is not going Modal...

Tried Rick S. trick of "set step on, clear all" in the Destroy() method BUT nothing is Hanging...
Display Memo only shows the system variables...

I think its the Mappoint control. It tries to change the path to "My Documents"
thus oMap = Addbs(Sys(5)+Sys(2003))+'new map.ptm'

If the map is moved or resized, NO Error...

Other Ideas Please...
 
Question: are you trying to quit the app while the form is open, or have you successfully closed the form and then tried to quit?

(If it *seems* you've closed the form, is it really still hanging around due to a stuck data session?)

When you say the control "changes the path" do you really mean working directory? (Not that either should matter.)
 
Dan; the application closes, Releases all forms, libs etc but when it encounters "Quit" it hangs. In development mode Display Memo shows Only System variables.
By default Mappont looks in "My Documents" for any Map it needs to open, once it found our map directory, it would change the default Path (for our app) to one that pointed to My Documents... Strange
so before I even instantiated the control I have to do this:
Code:
	*!*mappoint is changing the path so we need to reset the path
	*!*for exe TAKE THIS OUT use the next line
	oldPath = Sys(5)+Sys(2003)
	*!*oldPath = Addbs(Justpath(Sys(16)))
	.get_map()
	Set Default To (oldPath)
"Get_map" is a procedure in the form that starts Mappoint (see first code box)
I just dont see what is making Mappoint Hang as; if I dont run "Get_map" the app closes Just fine...
 
You did not answer my question. It was specific for a reason.

And what you are calling path is not the path (as in SET PATH) at all. It's the current working directory (as in SET DEFAULT). Diagnostics are difficult enough without changing the names of things. :)

When you mention encountering Quit, you're describing CLASSIC Foxpro behavior. Quit will cause CANNOT QUIT messages when READ EVENTS has not been released with CLEAR EVENTS.

But why are you issuing QUIT at all? It is absolutely never necessary in a runtime application. When the code ends, so does the application.
 
No Dan; the form is not open....

This is a full blown commercial app. With a startup routine and a shutdown one as well. The app is not the problem; it’s the mappoint control. Thanks though...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top