Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get rid of form by clicking outside the form
Message
From
18/10/2002 12:31:32
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00710203
Message ID:
00712938
Views:
20
>>You can check if form was resized though. This would not help when user just clicks on the resizing area, but 1-2 pixels outside of the form, though it will be a rare case, and solutionbelow would help in case form is resized.
>>
>>1. Remember original width and height of the form in some variables or properties.
>>2. Whe you check if formshould be closed, check also if form is resized. If yes - just do not close.
>>3. Update stored values of original form width and height in the Resized event of the form.
>
>And once more you give some very nice tips! I'll gonna try them.

To VLAD:

And here's my newest attempt. It works quite nice for me. I'm not sure about the necessity of the 4th case. And also there is some overtesting, e.g. the repeated tests of mdown(). Anyway, I thought you'd like to know and other people may try to improve it.
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form
	AutoCenter   = .T.
	lMouseOnForm = .T.
	nHeight      = -1
	nWidth       = -1
	lCheckDown   = .T.
	Name         = "Form1"

	ADD OBJECT timer1 AS timer WITH ;
		Interval = 10, ;
		Name = "Timer1"

	PROCEDURE timer1.Timer
		local loX
		with thisform
			do case
			case mdown() and .lCheckdown
				.lCheckDown = .f.
				loX = sys( 1270 )
				do case
				case vartype( loX ) # 'O' or loX # thisform
					.nHeight = .height
					.nWidth  = .width
				endcase
			case mdown() and not .lCheckDown
			case not mdown() and not .lCheckdown
				.lCheckDown = .t.
				if ( .nHeight = .height and .nWidth  = .width )
					.release    && alternative: .hide()
				endif
			case not mdown() and lower( wontop() ) # lower( thisform.name )
			case not mdown() and .lCheckDown
				.nHeight = -2
				.nWidth  = -2
			endcase
		endwith
	ENDPROC

ENDDEFINE
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Reply
Map
View

Click here to load this message in the networking platform