Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Switchboard Form Problems
Message
From
07/04/2004 18:07:53
 
 
To
07/04/2004 17:35:44
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00893093
Message ID:
00893121
Views:
35
PMFJI
BTW, seeing your code, I guess one evaluation is not necesary, I mean about PEMStatus(...), that's because if loForm is an object, then it has a BaseClass Property, also, the Forms collection always (and only) have Forms objects.
Are you looking for only for the CPDF form?, so it's not necessary to check if the Form Name is not "StartUp", so check the code I suggest..
PRIVATE llfound
llfound = .F.
FOR EACH loForm IN _Screen.FORMS
   IF UPPER(loForm.NAME) = 'CPDF'
	llfound = .T.
	IF loForm.WindowState=1
	   loForm.LockScreen = .T.
           loForm.WindowState = 0
	   loForm.LockScreen = .F.
	ENDIF
	loForm.refresh()	
	loForm.Show(loForm.WindowType)
    ENDIF
ENDFOR
IF !llfound
        *--This runs and then form releases itself for some reason
	DO FORM cpdf NAME ocpdf LINKED
ENDIF
I also love and use deffensive programming, but at least, the Forms collection works as it supose to work. I don't know if someone found a B on this.


>Ok I feel silly. That was it! Thanks Sorin!

>Tracy

>Most probably var ocpdf goes out of scope as soon as form cpdf instantiates. My guess is that var ocpdf should be public or private when form ocpdf is called.
>
>Hope this helps
>
>
>
>>I have a small switchboard form that has three buttons on it. Each button opens a form. However, when I click on any of the buttons, the 2nd form is instantiated and jumps to the forefront but after instantiating itself it immediately runs the form's unload and releases the form. Focus is returned to the switchboard form and it is then the only form still available. Why would this happen?
>>
>>Here is code in the command button:
>>
>>
>>PRIVATE llfound
>>llfound = .F.
>>FOR EACH loForm IN _VFP.FORMS
>>	IF VARTYPE(loForm) = "O" AND pemstatus(loForm, "BaseClass", 5);
>>           AND loForm.BASECLASS = "Form" AND loForm.NAME != "Startup"
>>		IF UPPER(loForm.NAME) = 'CPDF'
>>			llfound = .T.
>>			IF loForm.WindowState=1
>>				loForm.LockScreen = .T.
>>				loForm.WindowState = 0
>>				loForm.LockScreen = .F.
>>			ENDIF
>>			loForm.refresh()	
>>			loForm.Show(loForm.WindowType)
>>		ENDIF
>>	ENDIF
>>ENDFOR
>>IF !llfound
>>        *--This runs and then form releases itself for some reason
>>	DO FORM cpdf NAME ocpdf LINKED
>>ENDIF
>>
Apoya a Visual FoxPro usandolo legalmente
--
¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º
Espartaco Palma Martínez
SysOp PortalFox
http://www.portalfox.com
esparta@portalfox.com
Previous
Reply
Map
View

Click here to load this message in the networking platform