Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Two forms conflict
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Two forms conflict
Divers
Thread ID:
01556852
Message ID:
01556852
Vues:
75
Can i run two forms at same time??

my initial search for a record involves this start:
oform1=Newobject("form1")
Define Class form1 As Form

now i am on the record page and hit a menu button to take me to an editbox so i can access a memofield
thus
oFrm= CREATEOBJECT("Note") ...
DEFINE CLASS Note AS Form

the editbox opens BUT closes right away in a blink

HOWEVER:: if i don't use the intial search using 'form1', the editbox stays in view when i hit the menu tab.

Any ideas?? much appreciated
Could it have to do with the focus?
Before going into second form i clear events - release thisform - am i forgetting anything else that should be killed first.
there are no duplicate names that i can see.

thanks
k

here is the full code to access the editbox - which as i say opens fine if i go directly to the record without opening an intial form.
tnom = vname
strtofile(smemo,'m.txt')
*LOCAL oFrm

oFrm= CREATEOBJECT("Note")
oFrm.Edit1.Value = filetostr('m.txt') 
oFrm.caption = 'Notes for '+tnom 
oFrm.closable = .f.
oFrm.MinButton = .f.
oFrm.MaxButton = .f.
**left,top,width,height

oFrm.move(338, 22, 575,574,)

ofrm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  
ofrm.cmdCmndBtn1.Visible =.T.  
ofrm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  
ofrm.cmdCmndBtn2.Visible =.T.  
 

oFrm.Show
READ EVENTS  && Start event processing
ofrm.release() 



************************************

DEFINE CLASS Note AS Form
	ADD OBJECT Edit1 AS EditBox WITH ;
		Height= 440, ;
		Left= 16, ;
		ReadOnly= .f., ;
		TabIndex= 2, ;
		Top= 16, ;
		Width= 530, ;
		Value= ""
ENDDEFINE

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button
   Caption = 'SAVE Exit'  && Caption on the Command button
   Left = 100  && Command button column
   Top = 490  && Command button row
   Height = 35  && Command button height
  BackColor = RGB(255,255,110)
 
 PROCEDURE Click
 
nm = oFrm.Edit1.Value 
strtofile(nm,'m2.txt')
replace smemo with filetostr('m2.txt')
CLEAR EVENTS  && Stop event processing, close Form    
ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS COMMANDBUTTON  && Create Command button
   Caption = 'EXIT NoSave'  && Caption on the Command button
   Left = 375 && Command button column
   Top = 490  && Command button row
   Height = 35  && Command button height
  BackColor = RGB(255,255,110)
 
 PROCEDURE Click
 
*nm = oFrm.Edit1.Value 
*strtofile(nm,'m2.txt')
wait window 'changes have not been saved'+CHR(13)+CHR(13)+'exiting .. '  timeout 1 at 12,80 
CLEAR EVENTS  && Stop event processing, close Form
ENDDEFINE

   


Public Event MouseWheel As MouseWheelEventHandler


PROCEDURE Object.MouseWheel
LPARAMETERS nDirection, nShift, nXCoord, nYCoord

PROCEDURE edit1.MouseWheel
		LPARAMETERS nDirection, nShift, nXCoord, nYCoord

* Set focus to this control
		If Type("thisform.ActiveControl") # "O" or thisform.ActiveControl <> this
			this.SetFocus
		EndIf
    

		
	ENDPROC


oFrm.hide(1)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform