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

How to keep the closable 'X' button enabled on the screen

Status
Not open for further replies.

skorda

Programmer
Mar 3, 2004
13
US
I have an exe running a form in the screen window. It has a timer event that is waiting for activity. I want the closable 'X' button to stay enabled, so I put code in the Timer event, _screen.Closable = .t. This works as long as the focus is on the screen, but when I switch to another app and then back to VFP it is disabled again. I also tried putting the above code in the Activate of the form, to no avail. Does anyone know how to keep this button enabled, even when waiting for a timer event?

Sebastian
 
Sebastian,
I don't see this in VFP 8.0 SP1 under XP PRO SP2 - at least not what I think you are describing. What version and SP of VFP are you running? What OS?

Can you provide a short code example?

Rick
 
Sebastian,

I'm not sure why you need to do this. In general, the X button should stay active the whole time, unless you take some explicit action to disable it. If you are not normally seeing the X button, there must be something in your code somewhere that is disabling it.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Sebastian and Mike,

I have seen the mysterious disabling of the Close button in my tools and apps. I have not been able to reproduce the steps through to cause the problem. One of the nearly every time repro involves bring up a Help file (chm), but again, this is not an every time thing.


_RAS
VFP MVP
 
Rick,

You're talking about the Close button of the main window (_SCREEN), right?

If it was a form, I'd suspect a dangling object reference, but that's obvioulsy not the case with _SCREEN.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Well, whatever is causing this bizarre behavior (not having seen it myself) it is not related to the timer class or some kind of wait state that the _screen ends up in between timer events as running the code below will surely demonstrate:

Code:
Public goForm
goForm = createobject("form")

goForm.addobject("Timer1", "clsTimer")
goForm.show()

DEFINE CLASS clsTimer as Timer
Interval = 5000
PROCEDURE Timer
	MESSAGEBOX("Hello World")
ENDPROC

ENDDEFINE

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Rick, I tried using BINDEVENTS() to the _screen.Closable property and it works while the program is initializing (the 'X' button stays enabled, when before it did not). However, once I switch to another app and then back, the screen 'X' becomes disabled. It seems like maybe VFP overrides any programming. I am not sure why though, as I said the only thing that is happening at that point is the timer event running. Also, the only way I could get it to work at all, is to set the nFlag parameter to 3 (in BindEvents). Here is the simple code I wrote:
Code:
PUBLIC oNoClose
oNoClose = NEWOBJECT("sNoClose")
BINDEVENT(_SCREEN, "Closable", oNoClose, 'NoClose_proc', 3)

*** DO FORM HERE ***

DEFINE CLASS sNoClose AS Session
	PROCEDURE NoClose_proc
		_screen.Closable = .t.
	RETURN
ENDDEFINE
Since you are the only other person on this board this seems to have happened to, I was hoping you might have a solution!

Mike, yes, I am referring to the screen close button. The reason for this is a customer demand. There are no controls on the form, the only way to quit is ESC or the close button. This is a conversion from an old DOS program that monitors the modem port and a receive file directory for activity or new files. The customer does not want it to change!

Craig, the code you provided would not duplicate this situation, because the close button is on the screen, not the form. But I think you are right, it is not related to the timer control at all.

Thank you all for your feedback.

Sebastian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top