Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a Form
Message
From
25/07/2007 05:00:09
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
01243168
Message ID:
01243398
Views:
31
>>>I´m so used using a Framework (Mere Mortals), that I can´t solve this problem that seems to be so easy.
>>>I have a Project with a PRG (main) that calls a Form.
>>>
>>>DO FORM frmProcessamento_Diario_DOERJ LINKED
>>>
>>>READ EVENTS
>>>
>>>Everything working fine.
>>>Now I need to call a Modal Form from the first Form.
>>>The form is built, but processing don´t stop, in the second Form, for Data entering.
>>>What is wrong?
>>>
>>>Regards,
>>
>>Are you sure second form is modal? Probably its ShowWindow=2 which cannot be modal.
>>Cetin
>
>Thanks Cetin.
>In the second Form I need to input some variables. I need to call this Form, input Data, click on "Ok", close this Form and continue processing in the first Form. How it must be configured?
>
>Regards,

I don't know if you're using oForm = create... and show or do form. With 'do form' it looks like:

do form SecondForm && secondform is modal
* this line isn't reached till SecondForm is hidden/released

With CreateObject:

oForm = newobject('SecondForm','secondformclasslib.vcx')
oForm.Show(1)
* this line isn't reached until secondform is hidden/released

Here is a full sample in code:
PUBLIC oForm
oForm = CREATEOBJECT('FirstForm')
oForm.Show()

Define Class FirstForm As Form
	Add Object txt1 As TextBox With Top=10,Left=10
	Add Object txt2 As TextBox With Top=50,Left=10
	Add Object cmdSecond As CommandButton With ;
		Caption='Call Modal Form',AutoSize=.T.,Top=100,Left=10


	Procedure cmdSecond.Click
		Local loForm, luVal1, luVal2
		loForm = Create("Secondform")
		loForm.Left = thisform.Left + 100
		loForm.Top  = thisform.Top + 100
		loForm.Show(1)
		* Following code waits for secondform to become visible=.f.
		* in any manner 
		luVal1 = loForm.txtStart.Value
		luVal2 = loForm.txtEnd.Value
		Release loForm
		* Show result
		Thisform.txt1.Value = m.luVal1
		Thisform.txt2.Value = m.luVal2
	Endproc
Enddefine

Define Class SecondForm As Form
	Add Object txtStart As TextBox With Top=10,Left=10,Value=Date()-7
	Add Object txtEnd   As TextBox With Top=50,Left=10,Value=Date()
	Add Object cmdRelease As CommandButton With Top=100,Left=10,Caption='Exit'

	Procedure cmdRelease.Click
		Thisform.Hide()
	Endpro
Enddefine
The technique shown above is also a way to get multiple values from a modal form instead of returning a value from unload.
With do form it's almost exactly the same.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform