Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Shailendra Khandelwal
  Where is Shailendra Khandelwal?
 bhilwara
 India
 Shailendra Khandelwal
 Tags
Subject: RE: Wexist Command Not Working
Thread ID: 209327 Message ID: 209330 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: Visual Basic
Date: Saturday, December 27, 2008 9:53:41 AM         
   


> Sir,
>
> How Can I prevent to open Form again from menu. Wexist() command is not search form.
> For Example I am Writing in Skip For wexist('abc')
>
> Thanks !

WExist() works but it is referring to the form's window name which is determined by the object.Name -
so if you are doing something like "Do Form abc.SCX", then the object.Name by default would be "Form1".
IOW, it does not care for the SCX name nor for the form.Caption

However, you can use an object reference instead: the _screen.Forms collection automatically contains a reference for each running form object, so you can scan it, e.g.:
FOR EACH loForm IN _screen.Forms
	? loForm.Name
	&& If Lower(loForm.Name) == 'whatever' ...
NEXT


Or use the Name clause of the Do Form command:

PUBLIC oForm as Form
oForm = CREATEOBJECT('ParentForm')
oForm.Show()
READ EVENTS
RETURN

DEFINE CLASS ParentForm as Form
	AutoCenter = .T.
	Caption = "Parent Form"
	oChildform = .NULL.
	PROCEDURE Destroy
		This.oChildform = .NULL.
		CLEAR EVENTS
	ENDPROC

	ADD OBJECT cmdChildform as Commandbutton WITH ;
		Left = 100, Top = 100, Caption = "Child Form", Height = 24
	PROCEDURE cmdChildform.Click
		IF VARTYPE(Thisform.oChildform) <> 'O'
			Thisform.oChildform = CREATEOBJECT('ChildForm')
			&& DO FORM childForm.SCX NAME Thisform.oChildform LINKED && with an SCX form
		ENDIF
		Thisform.oChildform.Show()
	ENDPROC
ENDDEFINE

DEFINE CLASS ChildForm as Form
	Caption = "Child Form"
	BackColor = RGB(250,250,240)
ENDDEFINE



hth
-Stefan

ENTIRE THREAD

Wexist Command Not Working Posted by Shailendra Khandelwal @ 12/27/2008 9:23:21 AM
RE: Wexist Command Not Working Posted by Stefan Wuebbe @ 12/27/2008 9:53:41 AM
RE: Wexist Command Not Working Posted by Shailendra Khandelwal @ 12/27/2008 1:41:28 PM
RE: Wexist Command Not Working Posted by Yousfi Benameur @ 12/27/2008 10:56:29 PM