Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Two forms conflict
Message
 
À
11/11/2012 07:12:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01556852
Message ID:
01556933
Vues:
66
thanks for clarification koen.
i just tried this
oFrm.windowstate=(1)
oFrm.show()

and ran into the same problem of my form disappearing in a blink. it requires the show(1) to work.

adding to the mystery - when i approach this form from simple browse - i have to use show() for the form to work properly.

i will keep your information in mind if the form becomes unstable Koen - thanks for that - always welcome another avenue of solutions to explore.

k

>Hi,>
>Just for the record, WIndoState = the property to set ( 0 = Modeless (Default) 1 = Modal )
>
>Method Show = (according to the helpfile): ' Included for backward compatibility. Use the Refresh method to redisplay a control after changing the control's properties.'
>
>Dont know why in this case show(1) works for you.
>
>Regards,
>
>Koen
>
>>after a bit of experimenting i found that problem was in the line ofrm.show - i believe the (1) changes the form to modal.
>>thanks to tamar for steering me in that direction.
>>
>>oFrm.Show(1)
>>
>>this solved my problem
>>
>>
>>>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)
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform