Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing forms through a program script (.prg)
Message
From
25/09/2003 09:15:05
 
 
To
25/09/2003 04:38:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00832050
Message ID:
00832208
Views:
15
I can only get it to work with modeless forms as well. The problem is that a form that is modal imediately retains focus until it is closed. You cannot change the windowtype property either because it is readonly. I tested it with the code below. I will be watching to see if a workaround is found for this.
CLEAR
PUBLIC llquit
llquit = .F.
oform1=CREATEOBJECT('form1')
oform2=CREATEOBJECT('form2')
LOCAL loForm
FOR EACH loForm IN _SCREEN.FORMS
	IF UPPER(ALLTRIM(loForm.CAPTION))='FORM2'
		loform.text1.value="TEST"
		EXIT
	ENDIF
ENDFOR
oform1.show
oform2.show
DO WHILE !llquit
	READ EVENTS
ENDDO
RETURN


DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 122
	Width = 151
	DoCreate = .T.
	Caption = "Form1"
	ControlBox = .F.
	Closable = .F.
	Name = "FORM1"


	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 23, ;
		Top = 20, ;
		Width = 100, ;
		Name = "Text1"


	ADD OBJECT cmdclose AS commandbutton WITH ;
		Top = 68, ;
		Left = 23, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Close", ;
		Name = "cmdclose"


	PROCEDURE Init
		PARAMETERS llquit
		DODEFAULT()
	ENDPROC


	PROCEDURE Unload
		PRIVATE llstop
		llstop = .T.
		FOR EACH loForm IN _SCREEN.FORMS
			IF UPPER(ALLTRIM(loForm.CAPTION))='FORM2'
				* Other form is still open so do not quit read
				llstop = .F.
			ENDIF
		ENDFOR
		IF llstop
			llquit = .T.
			CLEAR EVENTS
		ENDIF
		DODEFAULT()
	ENDPROC


	PROCEDURE cmdclose.Click
		ThisForm.Release()
	ENDPROC


ENDDEFINE


DEFINE CLASS form2 AS form


	Top = 150
	Left = 150
	Height = 124
	Width = 185
	DoCreate = .T.
	Caption = "FORM2"
	ControlBox = .F.
	Closable = .F.
	WindowType = 0
	Name = "FORM2"


	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 51, ;
		Top = 24, ;
		Width = 100, ;
		Name = "Text1"


	ADD OBJECT cmdclose AS commandbutton WITH ;
		Top = 72, ;
		Left = 51, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Close", ;
		Name = "cmdclose"


	PROCEDURE Init
		PARAMETERS llquit
		DODEFAULT()
	ENDPROC


	PROCEDURE Unload
		PRIVATE llstop
		llstop = .T.
		FOR EACH loForm IN _SCREEN.FORMS
			IF UPPER(ALLTRIM(loForm.CAPTION))='FORM1'
				* Other form is still open so do not quit read
				llstop = .F.
			ENDIF
		ENDFOR
		IF llstop
			llquit = .T.
			CLEAR EVENTS
		ENDIF
		DODEFAULT()
	ENDPROC


	PROCEDURE cmdclose.Click
		ThisForm.Release()
	ENDPROC


ENDDEFINE
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform